Re: detect a running program
- Posted by "Greg Haberek" <ghaberek at gmail.com> Apr 14, 2006
- 473 views
> Using win32, is there a way to detect if a program is already running. I = want > to check if a program is already running. If so I don't want to launch it= a > 2nd time. I can't seem to find a reference it the archives. Assuming you mean Win32Lib, do this:
if setAppName( "My App Name" ) then -- another instance is already running abort( 0 ) end if
Works like a charm! I also have some longer code that will bring that running app to the front, which is a more appropriate behavior. Let me know if you'd like to see that code. ~Greg