473,320 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 2564

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mohit Gupta | last post by:
Hi all, Lately I have been working on an application in VB .net CF for Pocket PC device. I have a small question about Context Menu. When I try to close the window after context menu is poped...
5
by: Dean L. Howen | last post by:
Dear friends, Could we determine when context menu should appear?
8
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
1
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.