Board index » Visual Studio » how to run the execuatable before windows shutting down
|
C_Steve
|
how to run the execuatable before windows shutting down
Visual Studio89
Dear all, I would like to know how to run the execuatable before windows shutting down. Here is my simple code: Private Sub Command1_Click() Shell "C:\abc.bat", vbNormalFocus End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = vbAppWindows Then Shell "C:\abc.bat", vbNormalFocus MsgBox "Finished!!" End If End Sub Private Sub Form_Unload(Cancel As Integer) Call Command1_Click End Sub When I click Command1, it works When I shut down the Windows, the message box comes out but cannot execute "abc.bat". because after executed "abc.bat", a result file will be created. Do any expert can help me? Thanks - |
