How to impliment Mutex
-
Hi All I have to application and one Application is writing something in file and another one is reading from that file. And i used FindFirstChangeNotification but it is working some time and some time it is not working so i want to use create mutex for this communication and i am very new in Mutex and tried my level best to achive but count not carck. can any one help, How will i use MUtex. Thank In advance RYK
-
Hi All I have to application and one Application is writing something in file and another one is reading from that file. And i used FindFirstChangeNotification but it is working some time and some time it is not working so i want to use create mutex for this communication and i am very new in Mutex and tried my level best to achive but count not carck. can any one help, How will i use MUtex. Thank In advance RYK
Hi, So called "named Mutexes" can be uses between processes. So in this case give the Mutex the name of the File yout are using. But be careful, i think backlashes don't work with mutexes, so you should replace backslashes with some other character. cu a.
i know nothing
-
Hi All I have to application and one Application is writing something in file and another one is reading from that file. And i used FindFirstChangeNotification but it is working some time and some time it is not working so i want to use create mutex for this communication and i am very new in Mutex and tried my level best to achive but count not carck. can any one help, How will i use MUtex. Thank In advance RYK
Hi, just found some code that might help you:
HANDLE GetMutex() { CString Key = m_FileName; // Your Filename! Key.Replace('\\', '_'); HANDLE hMutex = ::OpenMutex(SYNCHRONIZE, TRUE, Key); if (!hMutex) { SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; hMutex = ::CreateMutex(&sa, FALSE, Key); } return hMutex; }
cu. a.i know nothing
-
Hi, just found some code that might help you:
HANDLE GetMutex() { CString Key = m_FileName; // Your Filename! Key.Replace('\\', '_'); HANDLE hMutex = ::OpenMutex(SYNCHRONIZE, TRUE, Key); if (!hMutex) { SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; hMutex = ::CreateMutex(&sa, FALSE, Key); } return hMutex; }
cu. a.i know nothing