General information
Category:
Windows API functions
Hello, I have been tasked with using CreateMutex to create a thread named "TheMutexObject". The purpose is to create this thread and then wait until no one else has that thread. I am running a Foxpro app with someone's Clarion app and we are having update contention in places. My code is simple and I am trying to test it with Messageboxes. I should be able to run many instances of this (in a exe) and as soon as I click "OK" on the messagebox, it should release the thread and the other instance should display the messagebox. It's not working and I don't know why.
Can anyone help me figure out why the it doesn't seem to be releasing?
Thanks so much...Tim
DECLARE INTEGER CloseHandle IN Kernel32 INTEGER hObject
DECLARE INTEGER CreateMutex IN Win32API INTEGER lpMutexAttributes, INTEGER bInitialOwner, STRING lpName
DECLARE Long WaitForSingleObject IN WIN32API Long hHandle, Long dwMilliseconds
DECLARE INTEGER ReleaseMutex IN Win32API INTEGER hMutex
lMutexString = "TheMutexObject"
lHandle = CreateMutex(0, 1, lMutexString)
lWaitReturn = WaitForSingleObject(lHandle, 0xFFFFFFFF)
MESSAGEBOX("This is the Time: " + TIME())
* File updates will go here
lReleaseReturn = ReleaseMutex(lHandle)
lCloseReturn = CloseHandle(lHandle)
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only