i wrote a little desktop utility which automatically detects an USB Stick which contains updates for antivirus patterns and software packages. It can either perform those updates on detection or on system shutdown/restart and here comes the problem... I am not able to get the suspended shutdown to work properly.. If i am using this code my application sucessfully blocks the windows shutdown, but won´t perform the updating process.
' >>>>Process Windows Shutdown<<<<
If m.Msg = WM_QUERYENDSESSION OrElse m.Msg = WM_ENDSESSION Then
ShutdownBlockReasonCreate(Me.Handle, "Performing #### and Kasperksy Updates...")
UnZipKit()
ShutdownBlockReasonDestroy(Me.Handle)
Return
End If
I already found out that i need to return FALSE somewhere, but i can´t figure out how. The Microsoft statement can be found here: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms700677(v=vs.85)
As for additional information, if i won´t include the RETURN windows shutdown won´t be delayed what so ever...
A different approach is to write a shutdown script. Like here described https://learn.microsoft.com/en-us/previous-versions/technet-magazine/dd630947(v=msdn.10)
a vbs script can do almost anything analogue to vb net-