Link to home
Start Free TrialLog in
Avatar of craig_capel
craig_capel

asked on

processHandle...

Madashi, Barry, Who Ever, HELP!!!!!!!!!!!

procedure TForm1.Button10Click(Sender: TObject);
var
wnd2: hwnd;
cid: longint;
pid: dword;
i: boolean;
it: boolean;
cpid: dword;
begin
wnd2:=strtoint(edit15.text); //handle of window (this is real)
pid :=GetWindowThreadProcessID(wnd2,@cpid);
         {pid:=GetCurrentProcessId;}                      //Here
cid := OpenProcess(PROCESS_ALL_ACCESS,i,pid);
edit15.text:=inttostr(pid);
edit16.text:=inttostr(cid);
TerminateProcess(cid,0);  //NOT TERMINATING
end;

pid:=GetCurrentProcessId; if i un rem this then guess what it terminates my program thats running, so if all the rest of the code works, what am i doing wrong with               pid:=GetWindowThreadProcessID(wnd2,@cpid);

For example this returns the value 4294646219 and the real number i need is:                        4294712551 its slighty out.... as you can from the number of wasted varibles i am running out of ideas, pleaseeeeeee help :)

am i even close, cos Madashi said do this a long time ago... processHandle := OpenProcess(...,processID, ...);  TerminateProcess(processHandle, 0); thats what i am working on, without any luck.......

Craig C.
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of craig_capel
craig_capel

ASKER

I am starting to dislike you Barry, i spent the whole day trying to  figure that little problem out!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thanks.....

Craig C.
haha LoL
 it is the same here dont worry ,i always spend ages on something trying to figure it out, then find it to be a simple 2 lines or something :-)