Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Fox Programs open...but
Message
 
To
12/06/2001 17:04:01
N. Lea
Nic Cross Enterprises
Valencia, California, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00518551
Message ID:
00518633
Views:
18
>This is the code that I am using, and all the title captions are different.
>
>*!* DECLARE INTEGER CreateEvent IN WIN32API ;
>*!* INTEGER lpEventAttributes, ;
>*!* SHORT bManualReset, ;
>*!* SHORT bInitialState, ;
>*!* STRING @ lpName
>*!* DECLARE INTEGER GetLastError IN Win32API
>*!* DECLARE CloseHandle IN Win32API INTEGER hObject
>*!* nEh = CreateEvent(0,0,1, PROGRAM(0) + '.EVENT')
>
>*!* IF GetLastError() = 183 OR nEh = 0
>*!* *-- This shows that office is currently running in the background.
>*!* = MESSAGEBOX('This application is currently running!' + CHR(13) + "You can't open it more than once", 16, '')
>*!* =CloseHandle(nEh)
>*!* QUIT
>*!* ENDIF
>*!* ENDIF


I haven't touched the CreateEvent method, but by looking at the code I think your problem might be PROGRAM(0). It will return the name of the master program. So let us say you have two application programs programmed in VFP and both use a start PRG file named MAIN.PRG. In that case PROGRAM(0) will return MAIN and you will only be able to run one of them. Since it looks like it creates an event called MAIN.EVENT for the first successful creation.

HTH,
- Erik Niese-Petersen

Crazy Dane in USA.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform