By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

Event on process creation

P: 3
Hi All,

One independent process is running. Is there any way available in Window to get the event in first process if some other specific process gets started by other independent application? Only the name of the process is available.

Regards,
Amit
Feb 19 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 1,510
Hi All,

One independent process is running. Is there any way available in Window to get the event in first process if some other specific process gets started by other independent application? Only the name of the process is available.

Regards,
Amit
not sure what you are trying to do. You can find information about the processes running using the pstat command
http://commandwindows.com/supporttools.htm

which you could run using the system() function
Expand|Select|Wrap|Line Numbers
  1.   system("pstat > file");
  2.  
and look at the resultant file
Feb 19 '07 #2

P: 3
HI,

The code is written in VC++ and the platform is Window.

Actually i want to trap an event into my process whenever a new process (over which i do not have any control or created by some other application) is created.

Regrads,
amit
not sure what you are trying to do. You can find information about the processes running using the pstat command
http://commandwindows.com/supporttools.htm

which you could run using the system() function
Expand|Select|Wrap|Line Numbers
  1.   system("pstat > file");
  2.  
and look at the resultant file
Feb 19 '07 #3

Expert 100+
P: 1,510
HI,

The code is written in VC++ and the platform is Window.

Actually i want to trap an event into my process whenever a new process (over which i do not have any control or created by some other application) is created.

Regrads,
amit
there may be WIN32 functions you can call for this but as I try to avoid using Windows I cannot help. However, have alook thru
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true
http://labnol.blogspot.com/2006/04/useful-windows-xp-dos-commands-tricks.html
http://www.microsoft.com/downloads/details.aspx?familyid=49AE8576-9BB9-4126-9761-BA8011FABF38&displaylang=en
http://commandwindows.com/supporttools.htm

alternativly you could use system to call pstat() at regular intervals to see what has changed.
Feb 19 '07 #4

Banfa
Expert Mod 5K+
P: 8,916
There is no way to receive an event when a specific process is started because in Windows events run off handles and a process does not have a handle before it is running.

However you can enumerate the currently running processes using functions in the ToolHelp Windows Library.

Take a look at these functions

CreateToolhelp32Snapshot
CloseToolhelp32Snapshot
Process32First
Process32Next

You could then work out if the process you are interested in has started.
Feb 20 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.