|
26.07.2008, 02:49
|
#1
|
AnyKey`щик
Регистрация: 26.07.2008
Сообщений: 4
Написано 0 полезных сообщений (для 0 пользователей)
|
Releasemutex Api ( hi! )
Hi!, this is my first post an a Russian forum
i'm from italy .. and.. i would use bmax for winapi access...
i used in a my app, the createmutex
Function CreateMutex:Int(lpMutexAttributes :Int , bInitialOwner:Int, lpName : Byte Ptr) = "CreateMutexA@12"
.. but i can't perform the RELEASE....
there is anyone that can post an example for a functionally RELASEMUTEX?
( openmutex can work on Bmax? )
Thx to all
|
(Offline)
|
|
26.07.2008, 11:38
|
#2
|
Дэвелопер
Регистрация: 17.01.2006
Сообщений: 1,512
Написано 78 полезных сообщений (для 110 пользователей)
|
Ответ: Releasemutex Api ( hi! )
http://msdn.microsoft.com/en-us/library/ms685066.aspx
BOOL WINAPI ReleaseMutex(
__in HANDLE hMutex
);
Parameters
hMutex [in]
A handle to the mutex object. The CreateMutex or OpenMutex function returns this handle.
|
After calling CreateMutex you get a handle of the newly created mutex. Store it in a variable and pass as an argument to the ReleaseMutex function when you no longer need it.
Check MSDN for additional details.
|
(Offline)
|
|
26.07.2008, 16:44
|
#3
|
AnyKey`щик
Регистрация: 26.07.2008
Сообщений: 4
Написано 0 полезных сообщений (для 0 пользователей)
|
Ответ: Releasemutex Api ( hi! )
yes, i do that...
Const ERROR_ALREADY_EXISTS = 183
Extern "win32"
Function CreateMutex:Int(lpMutexAttributes :Int , bInitialOwner:Int, lpName : Byte Ptr) = "CreateMutexA@12"
Function GetLastError:Int() = "GetLastError@0"
Function openmutex:Int(aaaa:Int, bbbb:Int,cccc : Byte Ptr) = "OpenMutex@12"
Function ReleaseMutexA:Int(ffff :Int) = "ReleaseMutex@4"
End Extern
ret = CreateMutex(0,1 ,"MYMUTEX".ToCstring())
If ret<>0 If getlasterror () = ERROR_ALREADY_EXISTS Print "Already present! 1"
Print releasemutexa (ret)
ret = CreateMutex(0,1 ,"MYMUTEX".ToCstring())
If ret<>0 If getlasterror () = ERROR_ALREADY_EXISTS Print "already present! 2"
Print releasemutexa (ret)
'an ... OPENMUTEX test.....
ret = openmutex(0,1 ,"MY MUTEX".ToCstring())
'compiler error:
'untitled4.bmx.gui.release.win32.x86.o: undefined reference to `OpenMutex@12'
but... don't work , what's wrong?
|
(Offline)
|
|
26.07.2008, 20:59
|
#4
|
Дэвелопер
Регистрация: 17.01.2006
Сообщений: 1,512
Написано 78 полезных сообщений (для 110 пользователей)
|
Ответ: Releasemutex Api ( hi! )
I'm not able to check this, but I believe it should be either "OpenMutexA@12", or "OpenMutexW@12".
|
(Offline)
|
|
26.07.2008, 21:28
|
#5
|
☭
Регистрация: 26.09.2006
Сообщений: 6,035
Написано 1,474 полезных сообщений (для 2,707 пользователей)
|
Ответ: Releasemutex Api ( hi! )
у автора:
значит:
"OpenMutex A@12"
|
(Offline)
|
|
26.07.2008, 22:46
|
#6
|
|
Ответ: Releasemutex Api ( hi! )
maybe simple use LoadLibraryA and GetProcAddress functions ?
lib:Int = LoadLibraryA("somedll.dll")
Global SomeFunction%()"Win32" = GetProcAddress(lib, "SomeFunction@0")
|
|
|
27.07.2008, 00:57
|
#7
|
AnyKey`щик
Регистрация: 26.07.2008
Сообщений: 4
Написано 0 полезных сообщений (для 0 пользователей)
|
Ответ: Releasemutex Api ( hi! )
WOW! openmutex seems to work!
Extern "win32"
Function CreateMutex:Int(lpMutexAttributes :Int , bInitialOwner:Int, lpName : Byte Ptr) = "CreateMutexA@12"
Function openmutex:Int(aaaa:Int, bbbb:Int,cccc : Byte Ptr) = "OpenMutexA@12"
End Extern
print "there is mutex: <TEST> ?"
if openmutex(1,1,"test".tocstring()) print "YES!"; else print "NO!"
print "creating TEST mutex"
CreateMutex(0,1, "test".ToCstring())
if openmutex(1,1,"test".tocstring()) print "YES!"; else print "NO!"
thx alcoSHoLiK and HolyDel !
for Jimon... umh... i don't know how to use the loadlibraryA... ( any example? )
|
(Offline)
|
|
27.07.2008, 01:13
|
#8
|
|
Ответ: Releasemutex Api ( hi! )
i see your code works, then you don't need these functions
|
|
|
27.07.2008, 03:24
|
#9
|
Дэвелопер
Регистрация: 17.01.2006
Сообщений: 1,512
Написано 78 полезных сообщений (для 110 пользователей)
|
Ответ: Releasemutex Api ( hi! )
gatsu.
I'm trying not to be bothersome, but MSDN has answers to all questions regarding Win API
http://msdn.microsoft.com/en-us/libr...75(VS.85).aspx
|
(Offline)
|
|
27.07.2008, 05:55
|
#10
|
AnyKey`щик
Регистрация: 26.07.2008
Сообщений: 4
Написано 0 полезных сообщений (для 0 пользователей)
|
Ответ: Releasemutex Api ( hi! )
thx Alcosholik
|
(Offline)
|
|
Ваши права в разделе
|
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения
HTML код Выкл.
|
|
|
Часовой пояс GMT +4, время: 09:49.
|