|
From: Gerhard Bunzel on 13 Jun 2008 09:31 Hi Kunu, this works fine for me: METHOD AlreadyExists () CLASS App LOCAL cID_App AS STRING LOCAL lIsRunning AS LOGIC cID_App := "MyAppID" CreateMutex(null, TRUE, String2Psz(cID_App)) lIsRunning := (ERROR_ALREADY_EXISTS == GetLastError()) RETURN lIsRunning METHOD Start() CLASS App .... IF .NOT. SELF:AlreadyExists() .... ELSE cValue := "MyShellWindowCaption" pHandle := FindWindow(String2Psz("ShellWindow"), String2Psz(cValue)) IF pHandle != NULL_PTR ShowWindow( pHandle, SW_SHOWNORMAL) SetForegroundWindow(pHandle) ENDIF ENDIF HTH Gerhard "Kuno" <kuno(a)retailsoftware.com> schrieb im Newsbeitrag news:8a5a765d-39c3-4d62-a760-f78932623b76(a)j33g2000pri.googlegroups.com... > I am using ShellExecuteEx to run another program (c:\Program Files\X- > Charge\XCharge.exe) to run credit cards. It works fine unless the > program is already loaded. I would like to test for this. I have tried > CreateMutex but it always returns false: > > > Method AlreadyExists() class MyModule > CreateMutex(null,true,String2Psz("XCHARGE")) > Return (GetLastError()==ERROR_ALREADY_EXISTS) > > Any advice would be very welcome. > > Kuno
|
Pages: 1 Prev: No exported method in 2.8 Next: Serious problem with FabSplitShellWindow |