|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how to run the execuatable before windows shutting downI 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 Hello leo***@gmail.com,
You'll have to cancel the shutdown, launch your app, and then initiate a second shutdown. This is NOT a good idea. shutting down a system is NOT the time to be launching apps. Cancelling a user-requested shutdown is punishable by castration in some places. Rethink your design. -Boo Show quoteHide quote > 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 > leo***@gmail.com wrote:
> I would like to know how to run the execuatable before windows shutting Why?> down. What do you want this program to do? When Windows shuts down, it can be quite harsh in its treatment of running processes - have you ever seen the "End Now" dialog? You cannot override that kind of behaviour. Whatever it is you need to do, how about doing it the next time Windows /starts up/? Just add a shortcut into the StartUp group. It's easier to see what's going on and more reliable. HTH, Phill W. Show quoteHide quote > 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 > Not sure if this will work for you, but you can assign a Shutdown script using
Group Policy. <leo***@gmail.com> wrote in message Show quoteHide quote news:1159333199.742678.132480@m7g2000cwm.googlegroups.com... > 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 >
how to get both old and new value for a changed text box
check username and password in database A question of design How to make stacktrace include linenumber for release compiles? REPLACE method: unwanted multiple-replacement Detect right-click in MDI container's client area? word length occurance in a text.. Visual Studio Proffessional 2005 Finding embedded controls? Data Access Advice |
|||||||||||||||||||||||