Just how to make use of a mutex in Visual Basic

I have actually imported the kernel32 collection. So, I have the createMutex function readily available yet I am not fairly certain of the numerous parameters and also return values.

This is timeless Visual Basic, not Visual Basic.NET yet I can possibly collaborate with either language in the kind of a solution.

2019-05-03 19:09:50
Source Share
Answers: 2

The VB code looks something similar to this :

hMutex = CreateMutex(ByVal 0&, 1, ByVal 0&)

The first parameter is a reminder to an SECURITY_ATTRIBUTES framework. If you do not recognize what it is, you do not require it. Pass NULL (0 ).

The 2nd parameter is TRUE (non - absolutely no, or 1) if the calling string needs to take possession of the mutex. FALSE or else.

The 3rd parameter is the mutex name and also might be NULL (0 ), as revealed. If you require a called mutex, pass the name (anything one-of-a-kind) in. Not exactly sure whether the VB wrapper marshals the size - prefixed VB string type (BSTR) over to a null - ended Ascii/Unicode string otherwise, you'll require to do that and also countless instances are around.

All the best!

2019-05-08 21:09:27

Well, based upon the documentation it resembles :

  1. Security features (can pass null)
  2. Whether it's originally possessed (can pass incorrect)
  3. The name of it


2019-05-08 21:02:56