How to get RECT or DC of context menu ?

  • Thread starter Thread starter Yuri O.
  • Start date Start date
Y

Yuri O.

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
 
Yuri O. said:
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
 
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.
 
Back
Top