Bryant
Thanks this is a simple and small routine that does the job, I just inserted
it in my start program and it catches the second instance every time.
Thank you very much.
Jerry

-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Bryant
Sent: Monday, February 18, 2013 8:47 AM
To: [email protected]
Subject: RE: Program already running

I use the following"
*******
* Start of Code
*
LOCAL llQuit    
*!* Check for instance(s) of Myapp running 
oManager = GETOBJECT([winmgmts:]) 
cQuery = [select * from win32_process where name='cemetery.exe']   &&
cemetery.exe is the name of my program
oResult = oManager.ExecQuery(cQuery)

IF oResult.Count > 1
  llQuit = .T.
ENDI    
*!* Clean up
oManager = .NULL.
oResult = .NULL.
RELEASE cQuery, oResult, oManager

IF llQuit && cemetery.exe running twice
   MESSAGEBOX("One copy of this program is already running.  ",48,"Warning
Message")
  QUIT
ENDIf
*
* End of Code
*********

-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of jerry
foote
Sent: Monday, February 18, 2013 9:14 AM
To: [email protected]
Subject: Program already running

I have a program written in vfp8 running on xp. I HAVE to stop a second
instance of the program from running.

Any suggestions.

Jerry



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/E318428B53D4422A84766F95069B4DA2@jerryfootePC
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to