Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to Get Process ID Thread

Keywords:  GetWindowThreadProcessId

;DWORD GetWindowThreadProcessId(
;  HWND hWnd,             // handle to window
;  LPDWORD lpdwProcessId  // process identifier
;)

#DefineFunction GetProcessID(h)
bb=BinaryAlloc(4)
BinaryEODSet(bb,4)
dllname=strcat(DirWIndows(1),"user32.dll")
DllCall(dllname,long:"GetWindowThreadProcessId",long:h,lpbinary:bb)
p=BinaryPeek4(bb,0)
return (p)
#endFunction


hwnd=DllHwnd("")  ; window title goes in here
pid=GetProcessID(hwnd)
Message(hwnd,pid)

Article ID:   W15164