Print Page | Close Window

Windows Mutex won't work with active Skinning

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=15172
Printed Date: 15 May 2024 at 6:33am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Windows Mutex won't work with active Skinning
Posted By: MatthiasB
Subject: Windows Mutex won't work with active Skinning
Date Posted: 15 September 2009 at 3:28am
I'm using Visual DataFlex 2009 v15 together with CodeJock v13.1.
We tried to avoid loading the same DataFlex program twice with the use of Mutex.
 
The following code works fine if I use the program caption in order to create a Mutex.
 
// external functions
#IFNDEF Get_CreateMuteX
    External_Function CreateMuteX "CreateMutexA" Kernel32.dll Integer i1 Integer i2 Integer i3 Returns Integer
#ENDIF
#IFNDEF Get_CloseHandle
   External_Function CloseHandle "CloseHandle" Kernel32.dll Integer i1 Returns Integer
#ENDIF
 
// function to create a mutex
Function Create_MuteX_Object String sLabel Returns Boolean
   Integer iVoid iErr
   String sID
   Move sLabel to sID
   Move (CreateMuteX(0,1,AddressOf(sID))) to ghMuteX
   If (ghMuteX <> ERROR_INVALID_HANDLE) Begin
       Move (GetLastError()) to iErr
       If (iErr = ERROR_ALREADY_EXISTS) Begin  // program is already
                                               // running
           Move (CloseHandle(ghMuteX)) to iVoid
           Move 0 to ghMuteX
           // kill the application here if you do not want to allow
           // multiple instances
           Function_Return False
       End
       Else Send None  // program is not already running
   End
   Else Send None  // rare error; object could not be created
   Function_Return True
End_Function  // Create_MuteX_Object
 
However if my program contains a Skin object:
 
Object oSkin is a cCJSkinFramework
   Set psSkinFile to "..."
   Set psSkinIni to "..."
End_Object
 
the function Create_MuteX_Object always creates a new mutex object ??!
 
Any ideas?

 


-------------
_____________
Best Regards
Matthias



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net