Getting a hWnd from a PID??

Blitz3D Forums/Blitz3D Programming/Getting a hWnd from a PID??

plash(Posted 2006) [#1]
Is there a win32 function to get a hwnd from a processid?


plash(Posted 2006) [#2]
.


b32(Posted 2006) [#3]
Hmm, it seems that not all threads have a hwnd. But if they have, you can use EnumWindows to enlist all hwnds in the screen and get their process ID. You can compare this ID with the one you have allready to find out what HWND belongs to what thread:
http://mail.python.org/pipermail/python-list/2003-March/153917.html
and
http://www.codeguru.com/forum/archive/index.php/t-229929.html


plash(Posted 2006) [#4]
And why cant i find the userlib to enumwindows?


markcw(Posted 2006) [#5]
because it's not there?
http://www.blitzbasic.com/codearcs/codearcs.php?code=1179
this may help.
Api_EnumWindows% (lpEnumFunc%, lParam%) : "EnumWindows"



plash(Posted 2006) [#6]
I haven't found any examples using EnumWindows either, can you show me one?


degac(Posted 2006) [#7]
Well, I found on Blitz3d ft this example

http://www.blitz3dfr.com/phpfrench/e107_forum/viewthread.php?tid=1975

Just change the 'user32_' with 'api_' to run the program.
More than this I can't do, sorry, for me is just walking in the fog...


Kev(Posted 2006) [#8]
Hi Syco.

EnumWindows can be found in user32.dll, it requires 2 param's these are as follows.

1) lpEnumFunc, this defines a pointer to callback function.
2) lParam, this is application defined value passed to the callback function.

first we have a problem when trying to setup the lpEnumFunc from within blitz3d, we simply cant get the address in memory of a blitz3d function. so we would be required to setup the call within our own created .dll

i have wrote the orginal winblitz3d using standard blitz3d source and hacked into it a simple winproc using a bank, although this realy is a pain in the backside to realy get any use from it.

if you require any more info/help getting this setup from within a .dll i try and help all i can.

kev