English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

This is the code i have for closing my app. the second sub is for an exit button in a context menu.
when the app closes either by, windows closing it, clicking the "X", or using the context menu, i get a close confirmation. I would like to not get this confirmation every time i shutdown windows.

also how can i make this app a service?

thanks
mike

2007-01-18 06:45:15 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

Private Sub ChangeCase_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
uninitiatehotkey()
NotifyIcon1.Visible = False
Dim result As MsgBoxResult
result = MessageBox.Show("Do you really want to quit?", "Quit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

If result = MsgBoxResult.No Then
e.Cancel = True
End If
End Sub



Private Sub CloseApp(ByVal e As System.Windows.Forms.FormClosingEventArgs)
uninitiatehotkey()
NotifyIcon1.Visible = False
Dim result As MsgBoxResult
result = MessageBox.Show("Do you really want to quit?", "Quit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

If result = MsgBoxResult.No Then
e.Cancel = True
End If
Application.Exit()
End Sub

2007-01-18 06:45:52 · update #1

3 answers

Not sure about vb.NET, but in VB-6, there's a QUERYunload event on the form, you might check that out. In VB-6 you can use the QUERYunload event to determine exactly what caused the form to unload, and then to cancel the unload if you want.

2007-01-18 14:01:41 · answer #1 · answered by Richard H 7 · 0 0

I actually have used homestead windows 8 Developer's Preview for a lengthy time period. I twin booted that with my homestead windows 7 and got here about to using it extra many times because it became swifter. i had to push it till eventually the expiration era. regrettably, i do not imagine the drag to the bottom action to close the Metro app works on the DP because it did on CP and RP. you want to press the homestead windows key on the keyboard to flee and produce you back to the Metro start up reveal screen. If a Metro app is going untouched, idle for it sluggish, the computer immediately terminates it in the different case, you should bypass over to the job manager on the computer part to terminate the app manually because those dreaded apps haven't got close buttons or window controls. it truly is only how the Metro apps artwork. I only disregarded the Metro apps for a lengthy time period and stuck to the computer. I had Metro disabled. i do not understand the way you're nonetheless waiting to apply DP because it expired for the reason that January. perchance replacing and dishonest the BIOS time settings? i'm stunned someone is left on some Utopia and nonetheless using it now that the customary public preview of homestead windows 8.a million is obtainable for receive and use. I actually have found a hack on a talk board on a thanks to disable the Metro interface on the Developer's Preview and also carry back the starting up button orb and the classic start up Menu. i'm positive, there are suggestion left on the internet someplace on a thanks to disable the Metro interface on DP besides the undeniable fact that the hack step I actually have used became extra useful. unhappy to assert, the talk board have taken it down because it became no longer valid even as the CP and RP got here out.

2016-11-25 01:43:44 · answer #2 · answered by Anonymous · 0 0

Yes, it is, but you are asking the wrong question.

Your event handler handles a FormClosing event, which happens whenever the form closes for whatever reason. The only exception would be if you used task manager to kill the process.

You can trigger FormClosing by clicking the window's close button, pressing Alt-F4 when the window has focus, or by explicitly calling Form.Close()

2007-01-18 07:16:35 · answer #3 · answered by Pfo 7 · 0 0

fedest.com, questions and answers