Topic: how to hook on another process

any one know about how to hook another process using C#.NET

for example

i wana create an win app that hook or track another process or exe file that when the exe file opend or closed. My app will store that info.

tnkz

Re: how to hook on another process

An easy solution would be this.
You can check the current process information in an interval.
When you got the name of your target exe file raise event that Its started.
After that when you lost the name of you target program raise even that its closed.
Now handle the events to store the information.
There can be a winapi for this. I am not sure.

http://url.ie/zybhttp://url.ie/zydhttp://url.ie/zyc
মুখে তুলে কেউ খাইয়ে দেবে না। নিজের হাতেই সেটা করতে হবে।

Re: how to hook on another process

thnkz shiplu for ur info. But i already know that i have to check my process info but i want to know what the process/procedure to check process info.

Re: how to hook on another process

A google search gave me this:

//Namespaces we need to use
using System.Diagnostics;
 
public bool IsProcessOpen(string name)
{
    //here we're going to get a list of all running processes on
    //the computer
    foreach (Process clsProcess in Process.GetProcesses) {
        //now we're going to see if any of the running processes
        //match the currently running processes. Be sure to not
        //add the .exe to the name you provide, i.e: NOTEPAD,
        //not NOTEPAD.EXE or false is always returned even if
        //notepad is running.
        //Remember, if you have the process running more than once,
        //say IE open 4 times the loop thr way it is now will close all 4,
        //if you want it to just close the first one it finds
        //then add a return; after the Kill
        if (clsProcess.ProcessName.Contains(name))
        {
            //if the process is found to be running then we
            //return a true
            return true;
        }
    }
    //otherwise we return a false
    return false;
}