Code: Select all
Structure RWMemory
mutex.l
Transport.b
SampleRate.l
DevSamplePos.l
PanSamplePos.l
DevBufferPos.l
PanBufferPos.l
SamplesToRender.l
EndStructure
OpenConsole()
*myRWMemory.RWMemory = AllocateMemoryGlobal("SQ4",SizeOf(RWMemory))
If *myRWMemory
*myRWMemory\mutex = CreateMutex_(0,1,"SQ4_Rewire")
WaitForSingleObject_(*myRWMemory\mutex,10000) ; Lock it
CommandLine.s = "c:\rewiresdk\sq4\client.exe"
StartupInfo.STARTUPINFO
StartupInfo\cb = SizeOf(STARTUPINFO)
StartupInfo\dwFlags = #STARTF_USESHOWWINDOW
StartupInfo\wShowWindow = #SW_SHOW
ProcessInfo.PROCESS_INFORMATION
CreateProcess_(0, @CommandLine, 0, 0, 0, 0, 0, 0, @StartupInfo, @ProcessInfo)
EndIf
PrintN("Press return to release mutex and exit")
Input()
CloseConsole()
CloseHandle_(*myRWMemory\mutex)
FreeMemoryGlobal(*myRWMemory)Client :
Code: Select all
Structure RWMemory
mutex.l
Transport.b
SampleRate.l
DevSamplePos.l
PanSamplePos.l
DevBufferPos.l
PanBufferPos.l
SamplesToRender.l
EndStructure
OpenConsole()
*myRWMemory.RWMemory = AllocateMemoryGlobal("SQ4",SizeOf(RWMemory))
If *myRWMemory\mutex
PrintN("Waiting...")
WaitForSingleObject_(*myRWMemory\mutex,#INFINITE) ; Lock it
Else
PrintN("No mutex to wait for...")
EndIf
PrintN("Press return to exit")
Input()
CloseConsole() Client is NOT waiting for mutex...
Someone any idea?
Thx.

