Access Controls in Other Apps
-
Is this possible? I want to create a separate "Find Text" program that will access, read, and control a Rich Edit Control in another application. Basically what i've figured out so far is that if i somehow get the handle to the control in another application (MS Enterprise Manager), I can send messages such as EM_FINDTEXT, EM_GETSELTEXT, and EM_SETTEXTEX to it. And then i'm assuming that it will react to these messages. I do know that I can get the handle to the window application, but can i get the handle to the controls within it?
-
Is this possible? I want to create a separate "Find Text" program that will access, read, and control a Rich Edit Control in another application. Basically what i've figured out so far is that if i somehow get the handle to the control in another application (MS Enterprise Manager), I can send messages such as EM_FINDTEXT, EM_GETSELTEXT, and EM_SETTEXTEX to it. And then i'm assuming that it will react to these messages. I do know that I can get the handle to the window application, but can i get the handle to the controls within it?
c121hains wrote: I do know that I can get the handle to the window application, but can i get the handle to the controls within it? Sure. See
FindWindowEx()
for this.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
c121hains wrote: I do know that I can get the handle to the window application, but can i get the handle to the controls within it? Sure. See
FindWindowEx()
for this.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
"The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window." ..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application? If so, how?
-
"The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window." ..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application? If so, how?
-
"The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window." ..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application? If so, how?
With the exception of the desktop, all windows are a child window. So if you already have a handle to the window of interest, you can use
FindWindowEx()
like:FindWindowEx(hWnd, NULL, class_name, NULL);
You can find out what goes in place of
class_name
by using Spy++. Just open up the window having the control you want to meddle with and use Spy++ to get the control's class name.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
"The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window." ..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application? If so, how?
c121hains wrote: But i'm looking for controls within a child window those controls are child windows (of the child window). I haven't used it for a while, but IIRC, you use FindWindowEx(), sending in a null as it's parent window. Find the child this time using it's parent window as one of the arguments, then find a child of that window (the controls you're talking about) by sending in it's parent as one of the arguments. get it? My articles www.stillwaterexpress.com BlackDice
-
c121hains wrote: But i'm looking for controls within a child window those controls are child windows (of the child window). I haven't used it for a while, but IIRC, you use FindWindowEx(), sending in a null as it's parent window. Find the child this time using it's parent window as one of the arguments, then find a child of that window (the controls you're talking about) by sending in it's parent as one of the arguments. get it? My articles www.stillwaterexpress.com BlackDice
ahh i see! ok Thanks. I used a program called WinDowse and when i place the cursor over the (what looks like a Rich Edit box) turns out to have the class name "DimensionEdit"! Another control used in MS Enterprise Manager is "DimensionDataCtrl". If i want to send any messages to these controls (child windows), I have to know what messages they are listening to. So far i can't find any information on DimensionEdit class. Could they have created their own class by inheriting a rich edit box?
-
ahh i see! ok Thanks. I used a program called WinDowse and when i place the cursor over the (what looks like a Rich Edit box) turns out to have the class name "DimensionEdit"! Another control used in MS Enterprise Manager is "DimensionDataCtrl". If i want to send any messages to these controls (child windows), I have to know what messages they are listening to. So far i can't find any information on DimensionEdit class. Could they have created their own class by inheriting a rich edit box?
The class that i want (DimensionEdit) is within a class called "#32770" and that itself is within a "#32770" which lies within the base "MMCMainFrame" window. Everytime I run HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "#32770", NULL); It fails to bring up the correct handle! Entering in the description of the window doesn't work either. Please help!
-
The class that i want (DimensionEdit) is within a class called "#32770" and that itself is within a "#32770" which lies within the base "MMCMainFrame" window. Everytime I run HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "#32770", NULL); It fails to bring up the correct handle! Entering in the description of the window doesn't work either. Please help!
c121hains wrote: The class that i want (DimensionEdit) is within a class called "#32770"... This is the standard dialog box class.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
c121hains wrote: The class that i want (DimensionEdit) is within a class called "#32770"... This is the standard dialog box class.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
So.. are you saying that this would work: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); ..but in Spy++, the name of the class is #32770. If it's a dialog class, how come the order of window controls is: - DimensionEdit - #32770 - #32770 - MMCEnterprise Manager Main Window When i'm looking at it, it is - Some edit box within a tab order control within a dialog box window all within the main Enterprise Manager window. :(:(:(
-
So.. are you saying that this would work: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); ..but in Spy++, the name of the class is #32770. If it's a dialog class, how come the order of window controls is: - DimensionEdit - #32770 - #32770 - MMCEnterprise Manager Main Window When i'm looking at it, it is - Some edit box within a tab order control within a dialog box window all within the main Enterprise Manager window. :(:(:(
c121hains wrote: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); Don't confuse C++ classes with window classes (those registered with
RegisterClass()
). See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
c121hains wrote: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); Don't confuse C++ classes with window classes (those registered with
RegisterClass()
). See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
I managed to finally get it working. I had to first grab the handle to the desktop and use GetNextWindow through about 200+ handles to get the one matching the partial window text that i was looking for. The dialog's window text that i wanted contained static and dynamic text. That was why i couldn't just find the window with just he window's text. Thanks for the help! :)
-
I managed to finally get it working. I had to first grab the handle to the desktop and use GetNextWindow through about 200+ handles to get the one matching the partial window text that i was looking for. The dialog's window text that i wanted contained static and dynamic text. That was why i couldn't just find the window with just he window's text. Thanks for the help! :)
Once you had the handle to the dialog itself, couldn't you then have used
GetDlgItem()
to get the handle to the control without having to enumerate through each control on the dialog?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
Once you had the handle to the dialog itself, couldn't you then have used
GetDlgItem()
to get the handle to the control without having to enumerate through each control on the dialog?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown