Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Fox Programs open...but
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00518551
Message ID:
00518684
Views:
11
>>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,

Seems like you explained it. So, the solution would be to create main program with the same name, as exe.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform