#1
|
|||
|
|||
vb.net win32Api enumchildwindows help
I can get ENUMWINDOWS to work and give me a list of all available windows and their title text. However I can't get ENUMCHILDWINDOWS to work. All examples I see are vb6 and don't convert to vb.net. I'm an asp.net (using vb.net) programmer so I never have to deal with callback functions or win32APIs so I'm lost here.
All I need to do is pass it a known hwnd (say PokerStars.exe) and it gives me the handles for all of the childs. Sounds easy but it's not for a dummy like me. If anyone has some sample code that works I'd greatly appreciate it. |
#2
|
|||
|
|||
Re: vb.net win32Api enumchildwindows help
Don't use child window, use thread window
Use GetProcessByName to get the process ID ex: "PokerStars" Use GetWindowThreadProcessID to get the main processes window thread ID Then use EnumThreadWindows with that Process ID to generate a callback you can capture all the sub window handles from. Vern P.S. Win32 API calls suck [img]/images/graemlins/smile.gif[/img] |
#3
|
|||
|
|||
Re: vb.net win32Api enumchildwindows help
[DllImport("User32.dll")]
static extern Boolean EnumChildWindows(int hWndParent,PChildCallBack lpEnumFunc,int lParam); delegate bool PChildCallBack(int hWnd,int lParam); private bool EnumChildWindowCallBack(int hwnd, int lParam) { // Do some crazy stuff in here } -- Call EnumChildWindows like this: EnumChildWindows(windowHandle, new PChildCallBack(EnumChildWindowCallBack), intSomeInteger); intSomeInteger can be any integer value, might be an ID of the owner window f.example. |
|
|