Re: How do I get a Handle to a Windows Associated Menu

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




There doesn't seem to be any menu handle at all i am looping around all the sibling windows getting there classes and handles and there is no menu i have looken in remote spy and there is nothing that looks like a menu except for something called "HHTaskBar".


ink





"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com> wrote in message news:eIgvwtY8HHA.2208@xxxxxxxxxxxxxxxxxxxxxxx
All of the menu handling, I would think, is handled by a single window per process. When you have two forms open from the same application, are there two instances of that menu handling window? If so, you may be out of luck for this scheme...

Paul T.

"ink" <ink@xxxxxxxxxxxxxx> wrote in message news:uH$1n5X8HHA.1164@xxxxxxxxxxxxxxxxxxxxxxx

There will be 2.

The one that is being automated and the one doing the automation. nothing else.

I am still in the dark how it will know what menu it is dealing with.
if you load up FormA with MenuA(with Exit button) on it and then you you click a button on FormA that loads up FormB with MenuB(with close button) on it. How dow you know were to send the windows message. What Handle am i looking for if i want to close FormB using the menu. should i be sending the message to FormB's Handle?


Thanks,
ink








"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com> wrote in message news:uoOorVW8HHA.600@xxxxxxxxxxxxxxxxxxxxxxx
How many copies of the program, or other CF programs, might be running at once on the target device. Always lazy, I'd be inclined to test with only the one you care about running and just assume that only one is there...

Paul T.

"ink" <ink@xxxxxxxxxxxxxx> wrote in message news:e4q7YQT8HHA.3900@xxxxxxxxxxxxxxxxxxxxxxx
Hi Paul,

Thanks for this i was hoping i would be able to do something like send a windows message as you say there is no need to see the menu as it is a automation application as long as the code behind it is run when the message is sent.

My only problem is that this class name(#NETCF_AGL_BASE_ ) is actually used for any Dot.Net container (TabControl, Panal and Forms) I can figure out which class is active parent container.

Would i need to send the windows message to the currently active form and then that would send it to its associated menu?

thanks,
ink





"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com> wrote in message news:%23wWSV2J8HHA.464@xxxxxxxxxxxxxxxxxxxxxxx
Unless you think that the OS isn't going to properly interpret the clicks, you don't really need to do that, at least in general. Each menu item in Win32 has a command value associated with it. When the item is clicked, the window associated with the menu gets a WM_COMMAND message with the command value for the selected menu item. You should be able to simulate the selection of the menu item without physically popping up the menu.

You'll probably have to use Remote Spy++ to figure out what command values are assigned to each menu item, since I don't think that they're explicitly set for managed code applications, and you'll need to verify that they don't change from run to run, but a quick test that I just ran came up with the same values each time. You'll also need to be sure that you're sending the WM_COMMAND message to the right window. A special window is created by the NET CF to catch menu commands. Look through the list in Remote Spy++ and you'll see it. It's class name is #NETCF_AGL_BASE_ in .NET CF 1.0.

Paul T.

"ink" <ink@xxxxxxxxxxxxxx> wrote in message news:OJM8MjF8HHA.3940@xxxxxxxxxxxxxxxxxxxxxxx
hi Paul,


i have a windows mobile 5 CF2.0 Prooof Of Deliver application that news End to End Load and functional testing.

As it is not practical to site with 50 devices infrount of me trying to use all 50 at the same time, i thought the next logical solution is to write a small application that can automate the users front end of the application.

i am doing pritty well at the moment. i can do almost everything i want. there is just a few things left.

And one of them is finding the menu.

i have a screen Tap method that takes in a Handle to a window and then that works out using get window rectangle where it needs to send the tap.

There are 2 hard keys on the Key board that are mapped to the menu that i may be able to send the Key board event for them to the screen but that still dose not solve the problem of the menu items. i gues i was hopping that a menu was made up od button like controls that i could get a handle to.

thanks,
ink











"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com> wrote in message news:ujPdaQ97HHA.2004@xxxxxxxxxxxxxxxxxxxxxxx
Why do you need it? Generally, that's a bad idea. Give us some information about what you're trying to do and maybe we can suggest something that would be supported.

Paul T.

"ink" <ink@xxxxxxxxxxxxxx> wrote in message news:uUoHSx87HHA.4712@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,

How do you get a Handle to the menu on a Form running in a different process using p/invoke and the Win API.

Unfortunately "HMENU GetMenu(HWND hWnd );" does not seem to be implemented in Windows Mobile 5.

I have opened "Remote Spy" and I don't see it there.

I think it might have something to do with the class "HHTaskBar" but I am not sure.

Any ideas welcome?

Thnaks,
ink













.



Relevant Pages

  • Re: How do I get a Handle to a Windows Associated Menu
    ... "ink" wrote in message ... Thanks for this i was hoping i would be able to do something like send a windows message as you say there is no need to see the menu as it is a automation application as long as the code behind it is run when the message is sent. ... "Paul G. Tobey " <p space tobey no spam AT no instrument no spam ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Can I use Ink in Word without a tablet PC (but with a USB tabl
    ... any idea why i still cannot use the "ink annotation" feature within ... > Right-Click the Windows Task bar. ... >> Does anyone know how to use ink in Word if I do not have a tablet PC? ...
    (microsoft.public.word.docmanagement)
  • Re: Loading two CF2 EXE into the same thread?
    ... This is what i am trying to achieve but on a windows mobile device. ... Chris Tacke, Embedded MVP ... "ink" wrote in message ... Dose any one have any idea on how to load one CF2 windows application from another into the same thread? ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Ink API and Terminal Services App Deployment
    ... Can the users utilize the new Vista Ink API's fully (handwriting input and ... will the users' Ink recognition engine be able to learn as it would ... want to host my application on Windows 2003 SP2 Terminal servers, ...
    (microsoft.public.windows.terminal_services)
  • Re: Intercept windows messager on WindowsCE
    ... key pressed, tap, opening of new window, closing of windows, and ... Paul G. Tobey ha scritto: ... This has to do with how Unicode/ANSI declarations are ... You can either #define SetWindowsHookEx SetWindowsHookExW or change ...
    (microsoft.public.windowsce.app.development)