Pause Code execution in a foreign process

delphi package - getting into other processes

Pause Code execution in a foreign process

Postby cool_tester » Mon Nov 01, 2004 8:49 am

Is it possible to inject some kind of API into a foreign process and Pause it's Code execution until i notify it to finish.
kind of like using Sleep() api in our own code to pause the execution but i want it done on a foreign process...
By the way i tried using that but it didn't work... instead my own application stoped processing while the foreign application was still doing it's business as usual.

Thanks.
cool_tester
 
Posts: 75
Joined: Sun Oct 31, 2004 5:45 am

Postby madshi » Mon Nov 01, 2004 2:32 pm

Sleep only impacts the current thread. So it won't help. You could use SuspendThread for all threads of the target process. But this can have strange effects. If you suspend a thread while it's doing something *very* important, you might freeze the whole OS. This can happen on Hyperthreading and SMP machines. Rarely, but possible.

If you don't care about that (though you should) you can use madKernel like this:

uses madKernel;

begin
Process('someProcess.exe').Suspend;

As easy as that.
madshi
Site Admin
 
Posts: 9414
Joined: Sun Mar 21, 2004 5:25 pm

Postby cool_tester » Mon Nov 01, 2004 9:11 pm

Thanks for the reply.
Is it possible to actually suspend a component that is runing inside my application so instead of an Exe file i need to suspend a Component or activeX Control based on Handle for example.. is this possible with MadKernel..?

Thanks again for your fast replies.
cool_tester
 
Posts: 75
Joined: Sun Oct 31, 2004 5:45 am

Postby madshi » Mon Nov 01, 2004 9:27 pm

You can't suspend a component.
madshi
Site Admin
 
Posts: 9414
Joined: Sun Mar 21, 2004 5:25 pm

Postby cool_tester » Mon Nov 01, 2004 9:47 pm

OK what about an ActiveX Control .... that my application is hosting.?
cool_tester
 
Posts: 75
Joined: Sun Oct 31, 2004 5:45 am

Postby madshi » Tue Nov 02, 2004 7:34 am

Maybe you can unload the ActiveX dll, but probably that would make your app crash. I've no idea.
madshi
Site Admin
 
Posts: 9414
Joined: Sun Mar 21, 2004 5:25 pm

Postby cool_tester » Tue Nov 02, 2004 9:43 am

Thanks, i will have to find other means, keep up the good work.
cool_tester
 
Posts: 75
Joined: Sun Oct 31, 2004 5:45 am


Return to madRemote

Who is online

Users browsing this forum: No registered users and 1 guest