|
-
May 24th, 1999, 10:21 AM
#1
I need to see if a process is running then activate it?
I need to find out if a process is running such as WinWord, then make it active and restore it if its hidden.
Anybody got any great code to do this.
Thanks in advance
Stuart Ledwich.
-
May 24th, 1999, 07:18 PM
#2
Re: I need to see if a process is running then activate it?
Hi,
Under NT,there might possibly be two running instances of winword each having its own process space.So in that case,what do u intend to do?under NT,each process has its own unique ProcessID.
i assume that u know the name of the process u are searching for(e.g winword.exe) and u are working under NT 4.0.
U got to use PSAPI(process status API) calls to enumerate the processID's of the processes in the system ,get their process handle by calling openprocess,get their module handle by calling EnumProcessModules(the first module is the exe),then call GetModuleBaseName to get their exe names and compare it with the app name u are interested in.
using this process handle and process ID,u can do what whatever NT allows u to do to that process.
-
May 25th, 1999, 01:39 AM
#3
Re: I need to see if a process is running then activate it?
Thanks for the reply, this sounds very close to what I need, except I would like to then activate the process and bring it to the front. How do I get a HWND from a process ID and process handle?
Thanks again for your help so far.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|