Old 22nd August 2003, 10:43   #1
zwuba
Junior Member
 
Join Date: Aug 2003
Location: Austria
Posts: 16
Question Determining if a process is running

Hi there again!

I just tried to find out if some process are running but the only way I find was FindWindow.
That's pretty nice for 90% of the processes I've to check but at least 6 processes doesn't have any hidden window so I need a possibility to determine if a process is running ... maybe via its exe-name ... that would be great

Does anyone of you got any idea how to do that?

PS: I do not want to kill the processes I just only need to know if they are running
zwuba is offline   Reply With Quote
Old 25th August 2003, 16:24   #2
ramon18
NSIS Dev
 
ramon18's Avatar
 
Join Date: Apr 2003
Location: Portugal
Posts: 110
The only way is creating a new plugin for this task, I can do that later when I got free time

cyas
ramon18 is offline   Reply With Quote
Old 26th August 2003, 05:14   #3
zwuba
Junior Member
 
Join Date: Aug 2003
Location: Austria
Posts: 16
I wrote a small C++ (and another C# too) app which takes the process name as command line parameter and do the check for me.

Now it works - thx
zwuba is offline   Reply With Quote
Old 26th August 2003, 09:26   #4
Sunjammer
Major Dude
 
Join Date: Jun 2002
Location: Swindon, UK
Posts: 559
Would you care to share your app with others? I can host it on the Archive downloads page if you'd like.
Sunjammer is offline   Reply With Quote
Old 26th August 2003, 11:34   #5
zwuba
Junior Member
 
Join Date: Aug 2003
Location: Austria
Posts: 16
Of course ... I'll attach the source to this post

Maybe I get enough time to convert it to a NSIS plugin ...

The Archive contains another two archives with the c++ and the c# source.

Tell me if you got any other questions
Attached Files
File Type: rar getprocessid.rar (23.5 KB, 411 views)
zwuba is offline   Reply With Quote
Old 24th September 2003, 16:00   #6
stonkers
Senior Member
 
Join Date: Sep 2003
Posts: 192
Has this been converted to a plugin? I have a need to check processes and pause if they're running. Thanks - Eric

Eric
stonkers is offline   Reply With Quote
Old 24th September 2003, 18:57   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That exe can be ran with Exec/nsExec to use it (I assume)
It is possible to write exe's that act like plugins, but it is harder to get the return value (unless you use nsExec::ExecToStack).

-Stu
Afrow UK is offline   Reply With Quote
Old 24th September 2003, 21:49   #8
stonkers
Senior Member
 
Join Date: Sep 2003
Posts: 192
If run this way, wouldn't the exe file have to live on the machine you deploy on? I'm trying to avoid having more pre-requisites on our servers...

Eric
stonkers is offline   Reply With Quote
Old 25th September 2003, 05:35   #9
zwuba
Junior Member
 
Join Date: Aug 2003
Location: Austria
Posts: 16
hi there!

yea you are right - I run this exe with nsExec and put the exe to my installer package - works fine
zwuba is offline   Reply With Quote
Old 26th September 2003, 11:27   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
stonkers, just copy it to $PLUGINSDIR using the File command. That's what NSIS does when you use a plug-in. The plug-in don't exist on the user's machine until the installer copies them to $PLUGINSDIR.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 30th January 2004, 18:36   #11
ursus76
Junior Member
 
Join Date: Jan 2004
Posts: 8
Quote:
just copy it to $PLUGINSDIR using the File command. That's what NSIS does when you use a plug-in. The plug-in don't exist on the user's machine until the installer copies them to $PLUGINSDIR.
Sorry, don't really understand! I copy the file to pluginsdir (SetOutPath "$PLUGINSDIR"; File "CheckProcess.exe")

And this command only works on installer but not uninstaller
(nsExec::ExecToStack "CheckProcess application" $PLUGINSDIR)

Anything missed?

Thank you!
ursus76 is offline   Reply With Quote
Old 30th January 2004, 18:41   #12
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Add InitPluginsDir before using the plus-ins folder.
Joost Verburg is offline   Reply With Quote
Old 30th January 2004, 18:41   #13
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes, the plug-ins directory is not the same for the installer and the uninstaller. If you want to use it in the uninstaller, you'd have to copy it to the uninstaller plug-in's directory. Simply copy it somewhere in the uninstaller's code, un.onInit for example (don't forget to call InitPluginsDir before you use $PLUGINSDIR).

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump