Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
How would you determine whether a menu item has been checked marked or not?
I can't see a way to narrow in on the right function call using Roboscripter, because once you get the menu to drop down, you have to click on Roboscripter to try and drag the cursor to the menu - and that causes the menu to disappear.
Any help would be appreciated.
I believe that if you look for the value of MF_CHECKED instead of using the select statement in the example , it should report if the menu item is checked.
A modified version of Guido's script would look something like this:
MF_BYPOSITION=1024 MF_CHECKED= 8 user32=dllload(strcat(dirwindows(1),"user32.dll")) ;get window handle hwnd=dllhwnd("WinBatch Studio") if hwnd==0 message("","Window not found") exit endif ;get menu handle hmenu=dllcall(user32,long:"GetMenu",long:hwnd) ;get dropdown menu handle based on position, 0 based subpos=3 ; 'View' hsub=dllcall(user32,long:"GetSubMenu",long:hmenu,long:subpos) ;get item state based on position, 0 based itempos=1 ; 'Status bar' state=dllcall(user32,long:"GetMenuState",long:hsub,long:itempos,long:MF_BYPOSITION) if state & MF_CHECKED then Message("State", "Checked") else Message("State", "Unchecked") dllfree(user32)
Thankyouthankyouthankyou! That did the trick. I had to do a little fiddling to find the proper values for subpos and itempos, but it works like a charm. And thank you Guido.
Article ID: W16450
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38