472,114 Members | 1,234 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,114 software developers and data experts.

How to get RECT or DC of context menu ?

Hi

I'm wondering whether is existing any working way of
getting real metrics about the active ContextMenu.
For example ContextMenu(.net) expose window handler
which I tried to use in GetWindowRect call - failed result;
Next i tried to get its DC - failed result too.
Finally I tried to get some info about menu with SPY++ but
it reported that windows cannot provide such info ?-)
Indeed developer cannot handle this one ? Is it a top secret :-)
Perhaps somebody know any workaround ...

Thanks
Yuri
Nov 15 '05 #1
3 2492

"Yuri O." <ps****@tut.by> schreef in bericht
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hi

I'm wondering whether is existing any working way of
getting real metrics about the active ContextMenu.
For example ContextMenu(.net) expose window handler
which I tried to use in GetWindowRect call - failed result;
Next i tried to get its DC - failed result too.
Finally I tried to get some info about menu with SPY++ but
it reported that windows cannot provide such info ?-)
Indeed developer cannot handle this one ? Is it a top secret :-)
Perhaps somebody know any workaround ...

Thanks
Yuri


I don't know how to get the info for the entire contextmenu, but you could
get the info for every item on that menu and maybe add that together to get
the full info. If you want to get the info for one menuitem look up
ownerdrawn menus.

Yves
If you make them ownerdrawn you
Nov 15 '05 #2
I'm looking for the same answer too.

I'm doing ownerdrawn and I tought of that, but with that I cannot get the
location of the windows, just the Size.

I mean I really need the real information, because if you do with ownerdrawn
you get the relatives values and not the absoulutes values, then the problem
is the next.

if you Display the context menu close to the Bottom of the screen windows
will decide that the menu has to go up instead go down, if you get the info
from ownerdrawn it only will be the size, if there is some chance to get the
location, then you have to do manual calculation between the workspace
size - location to know if it is bigger than the Size in that case the menu
is going up.

But all this is gonna work only for W2000 and after, because on W95/98/me
the context menu always is going down, then to get some simple information
like location and size can be a very painfull process, I cannot beleive that
there is not way to get this info from the context menu.

Thanks,
Gustavo.
"phoenix" <pa******@skynetWORK.be> wrote in message
news:uZ**************@TK2MSFTNGP11.phx.gbl...

"Yuri O." <ps****@tut.by> schreef in bericht
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hi

I'm wondering whether is existing any working way of
getting real metrics about the active ContextMenu.
For example ContextMenu(.net) expose window handler
which I tried to use in GetWindowRect call - failed result;
Next i tried to get its DC - failed result too.
Finally I tried to get some info about menu with SPY++ but
it reported that windows cannot provide such info ?-)
Indeed developer cannot handle this one ? Is it a top secret :-)
Perhaps somebody know any workaround ...

Thanks
Yuri

I don't know how to get the info for the entire contextmenu, but you could
get the info for every item on that menu and maybe add that together to

get the full info. If you want to get the info for one menuitem look up
ownerdrawn menus.

Yves
If you make them ownerdrawn you

Nov 15 '05 #3
Maybe the following can help a little
http://www.visual-basic.com.ar/vbsma...martmenuxp.htm

It's in VB6 though. It looks like the guy found out which class is used for
menus. If you could get the message loop of your program you could try to
filter it out and look at the data there. But i never tried anything like it
in dotnet yet.

Yves

"news.microsoft.com" <gu************@hotmail.com> schreef in bericht
news:e7**************@TK2MSFTNGP10.phx.gbl...
I'm looking for the same answer too.

I'm doing ownerdrawn and I tought of that, but with that I cannot get the
location of the windows, just the Size.

I mean I really need the real information, because if you do with ownerdrawn you get the relatives values and not the absoulutes values, then the problem is the next.

if you Display the context menu close to the Bottom of the screen windows
will decide that the menu has to go up instead go down, if you get the info from ownerdrawn it only will be the size, if there is some chance to get the location, then you have to do manual calculation between the workspace
size - location to know if it is bigger than the Size in that case the menu is going up.

But all this is gonna work only for W2000 and after, because on W95/98/me
the context menu always is going down, then to get some simple information
like location and size can be a very painfull process, I cannot beleive that there is not way to get this info from the context menu.

Thanks,
Gustavo.
"phoenix" <pa******@skynetWORK.be> wrote in message
news:uZ**************@TK2MSFTNGP11.phx.gbl...

"Yuri O." <ps****@tut.by> schreef in bericht
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hi

I'm wondering whether is existing any working way of
getting real metrics about the active ContextMenu.
For example ContextMenu(.net) expose window handler
which I tried to use in GetWindowRect call - failed result;
Next i tried to get its DC - failed result too.
Finally I tried to get some info about menu with SPY++ but
it reported that windows cannot provide such info ?-)
Indeed developer cannot handle this one ? Is it a top secret :-)
Perhaps somebody know any workaround ...

Thanks
Yuri


I don't know how to get the info for the entire contextmenu, but you could get the info for every item on that menu and maybe add that together to

get
the full info. If you want to get the info for one menuitem look up
ownerdrawn menus.

Yves
If you make them ownerdrawn you


Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.