Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is_run32 & mulitple instances
Message
 
To
18/07/2000 14:01:47
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00393284
Message ID:
00393949
Views:
15
>George,
>
>Even the 2nd, 3rd etc instances of the program GetLastError() returns 0.
>
>Have I set the thing up correctly? If so, must this all be done from a form not the main.prg?
>
>TIA
Mike,

You can store the class in a prg or vcx. The methods shown in the article (Init, Destroy and DisplayInstance) I think are all you need. In your main program, you should have code like this.
lcformcaption = _SCREEN.Caption
_SCREEN.Caption = ""
* Use only one of the next two lines.
SET PROCEDURE TO Mutex ADDITIVE && if in a prg
SET CLASSLIB TO Mutex ADDITIVE && if in a VCX
oMutex = CREATEOBJECT('Mutex', lcformcaption)
IF oMutex.nMutexErr # ERROR_ALREADY_EXISTS
  * Your normal setup code here. (DO MYMENU.MPR, READ EVENTS, etc.)
ELSE
  * If we hit this line, the other instance is displayed
  * and the current one released
  oMutex.DisplayInstance
ENDIF
Does this help?
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform