Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: GetWindowThreadProcessId GetCurrentProcessId
ThisPid = DllCall("kernel32.dll", long:"GetCurrentProcessId")
#DefineFunction GetCurrentProcessId() ;DWORD WINAPI GetCurrentProcessId(void); Return DllCall(DirWindows(1):"kernel32.dll",long:"GetCurrentProcessId") #EndFunction pid=GetCurrentProcessId() Message("Process ID",pid)
#DefineFunction GetProcessID(h) ;DWORD GetWindowThreadProcessId( ; HWND hWnd, // handle to window ; LPDWORD lpdwProcessId // process identifier ;) bb=BinaryAlloc(4) BinaryEodSet(bb,4) dllname=StrCat(DirWindows(1),"user32.dll") DllCall(dllname,long:"GetWindowThreadProcessId",long:h,lpbinary:bb) p=BinaryPeek4(bb,0) BinaryFree(bb) Return (p) #EndFunction hwnd=DllHwnd("") ; window title goes in here pid=GetProcessID(hwnd) Message(hwnd,pid)
Article ID: W15164
File Created: 2013:02:22:14:51:16
Last Updated: 2013:02:22:14:51:16