|
-
Oct 30th, 2001, 07:01 PM
#1
Thread Starter
Addicted Member
Dynamically get handles of other apps controls
Hi, I'm trying to add the capacity to interact with other application inside my app. More specifically I'm trying to add the capability to "activate" other apps command buttons based off there caption. I know I have to use the api to do this, so far this is where I'm at in the exploration of this concept.
Some aspects of my programs interaction will always remain true, the most important of which i think is that the window with the buttons and controls i want to activate are always going to be in the active foreground while my app is minimized. So I was thinking i could get the handle with
Public Declare Function GetForegroundWindow Lib "user32" () As Long
in a module and
lngWindowHandle = GetForegroundWindow
inside my apps form.
Now that I have the windows handle how do i get all the buttons handles and captions ?
I was looking at the EnumChildWindows api
Public Declare Function EnumChildWindows Lib "user32" (ByVal hwndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Any) As Long
But does this apply to buttons or only windows?
I do know how to use SendMessage and PostMessage to trigger the event based off the handle, but
I need to find out how to Get the handle based off the caption.
So far this is the information i have collected that i think would be helpful in determining the handles of buttons.
1. Handle of Desired Parent window or window with the controls
2. Desired Button Caption
3. Desired action to take.
If Anyone can give me a few pointers I'd really apreciate it.
Thanks
[email protected]
-
Oct 31st, 2001, 02:54 PM
#2
Thread Starter
Addicted Member
*Bump*
Thanks again guys.
-
Nov 2nd, 2001, 12:45 AM
#3
Thread Starter
Addicted Member
*Bump*
Sorry guys, I really need help with this
[email protected]
-
Nov 3rd, 2001, 12:33 PM
#4
Thread Starter
Addicted Member
-
Nov 4th, 2001, 05:01 AM
#5
Hyperactive Member
EnumChildWindows will do fine, it'll enumerate all child windows including buttons (If they aren't just painted, they should have a handle).
-
Nov 5th, 2001, 10:15 AM
#6
Thread Starter
Addicted Member
Could you maybe post a proper usage of Enum all windows. I've never been able to figure out how to get the handle using it.
Thanks for the reply.
-
Nov 5th, 2001, 10:52 AM
#7
Hyperactive Member
Public Declare Function EnumChildWindows Lib "user32" Alias "EnumChildWindows" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Sub main
EnumChildWindows windowhwnd, addressof Enummerate, 0
end sub
Private funtion Enumerate(hWnd as long, lParam as long)
'hWnd = hwnd of childs
'this function will be called as many times as there ar childs.
'If a child window has created child windows of its own,
'EnumChildWindows enumerates those windows as well.
'This function (Enumerate) MUST be placed in a module.
'Otherwise it won't work
'If this doesn't work, just say. Next time, I'll test it.
end function
Last edited by Xa0z; Nov 5th, 2001 at 11:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|