I am processing the %WM_QUERYENDSESSION message like this:
The logic of the code is simple, if restarting or turning the computer off
is not allowed, cancel the shut down and display a window explaining the reason.
This is for an internet cafe, so, turning the computer off is not necessary
or allowed to customers.
Anyway... the thing is that the computer shutdown is successfully cancelled
only when i remark this code:
This code is located in the WM_CREATE message of the window that displays the reasons to cancel shutdown.
If i remoive or remark that code, it works smoothly. If i enable it, the computer restarts.
Why could this be happening???
Code:
Case %WM_QUERYENDSESSION If ItsOkToClose Then Exit Select If BlockonShutdown Then Function = 0 ' prevent Windows from restarting or shutting off. Call PostMessage(hWndForm, 16241, 0, 0) EXIT FUNCTION End If Case 16241 Call BloquearUnidad(Wparam) ' Launch a window saying it is forbidden.
is not allowed, cancel the shut down and display a window explaining the reason.
This is for an internet cafe, so, turning the computer off is not necessary
or allowed to customers.
Anyway... the thing is that the computer shutdown is successfully cancelled
only when i remark this code:
Code:
If IsTrue(Len(Trim$(Config.Sonido.Bloquear, Any Chr$(0,32)))) Then If InStr(Trim$(Config.Sonido.Bloquear, Any Chr$(0,32)), Any "\/:") Then Call SndPlaySound(ByCopy Trim$(Config.Sonido.Bloquear, Any Chr$(0,32)), %SND_FILENAME Or %SND_ASYNC) Else Call SndPlaySound(ByCopy FixName(Trim$(Config.Sonido.Bloquear, Any Chr$(0,32))), %SND_RESOURCE Or %SND_ASYNC) End If End If
If i remoive or remark that code, it works smoothly. If i enable it, the computer restarts.
Why could this be happening???
Comment