Jump to content

How to get all controls of another windows program?


Recommended Posts

I have never had the need to get all the controls of another program, until now.

My main goal is to be able to get the handles of the right-click menu.

I have tried Au3Info.... but of course the menu disappears when I drag the tool to the menu.

Any help would be appreciated.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Wow, didn't know you could that.

It shows the GUI handle, but not the right-click menu handles.

-edit-

It does show the menu handle, but not the menu item controls.

 

Edited by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Using GuiMenu, I was able to get the GUI Main Menu but not the right-click menu.

I will sift through the GuiMenu examples here on the forum, and see if I can come up with a solution.

Thanks for your response.

 

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Here to get you started with Notepad though :

#include <Constants.au3>
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>
#include <WinAPIConv.au3>

Opt ("MustDeclareVars", 1)

Run ("Notepad.exe")

Local $iDWord = _WinAPI_MakeLong (0x200, 0x120) ; ($x, $y)

Local $hWnd = WinWaitActive ("[CLASS:Notepad]")
Local $hCtrl = ControlGetHandle ($hWnd, "", "Edit1")
_WinAPI_PostMessage ($hCtrl, $WM_CONTEXTMENU, 0, $iDWord)
Sleep (800)

Local $hMenuWnd = WinGetHandle ("[CLASS:#32768]")
Local $hMenu = _SendMessage($hMenuWnd, $MN_GETHMENU)
If Not _GUICtrlMenu_IsMenu($hMenu) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Unable to retrieve context menu handle")

Local $iCount = _GUICtrlMenu_GetItemCount ($hMenu)
For $i = 0 to $iCount-1
  ConsoleWrite (_GUICtrlMenu_GetItemText ($hMenu, $i) & @CRLF)
Next

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...