Restored from previous forum. Originally posted by Paul.
Ummm.... you aren't using any constants for starters.
I could be wrong but win API declares PROCESS_ALL_ACCESS as something like:
#STANDARD_RIGHTS_REQUIRED=$F0000
#SYNCHRONIZE=$100000
#PROCESS_ALL_ACCESS=#STANDARD_RIGHTS_REQUIRED|#SYNCHRONIZE|$FFF
and GetWindowThreadProcessId as:
Code: Select all
DWORD GetWindowThreadProcessId(
HWND hWnd, // handle of window
LPDWORD lpdwProcessId // address of variable for process identifier
);
so maybe...??
hWnd=FindWindow_(0,"Calculator")
proid=GetWindowThreadProcessID_(hWnd,@pid)
and maybe...
pHandle.l = OpenProcess_(#PROCESS_ALL_ACCESS, 0, pid)
I'm not saying this will work, but it's probably closer than what you have there.
Fred would probably know best
Edited by - paul on 31 March 2002 23:13:21