1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
DWORD dwCount=0, dwWaitResult;
AnsiString Info;
AnsiString Ip,Mac,Nom;
switch (dwWaitResult)
{
// The thread got ownership of the mutex
case WAIT_OBJECT_0:
__try {
Ip = CAddIp;
Mac = CAddMac;
Nom = CNomNetBios;
Info = Nom + " " + Ip + " " + Mac ;
Form1->Memo1->Lines->Add(Info);
}
__finally {
// Release ownership of the mutex object
if (! ReleaseMutex(ghMutex))
{
// Handle error.
// Form1->Memo1->Lines->Add("handle error");
}
}
break;
// The thread got ownership of an abandoned mutex
// The database is in an indeterminate state
case WAIT_ABANDONED:
Form1->Memo1->Lines->Add("erreur");
} |
Partager