Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - Windows Mutex won't work with active Skinning
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Windows Mutex won't work with active Skinning

 Post Reply Post Reply
Author
Message
MatthiasB View Drop Down
Newbie
Newbie


Joined: 15 September 2009
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote MatthiasB Quote  Post ReplyReply Direct Link To This Post Topic: Windows Mutex won't work with active Skinning
    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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.137 seconds.