T
ThunderMusic
Hi,
I'm trying to have a MSN Messenger like form/app closing behavior. When I
click on the X button, I only want the form to disappear and when I
double-click on the notify icon or right-click on it and choose Open from
the context menu, I want the form to reappear. For that, I got the point
covered. Even when the form is minimize, the behavior is like MSN Messenger.
But one problem arose. When I close the form (the first time), it disappears
(that is ok), but after that, when I open it again, it appears, then if I
try to close it (for the second time), it disappears then reappears
immediately, if I close it again (for a third time), then, it disappears...
In fact, except for the first time I close it, I have to close it twice...
I supplied the the code I use (maybe there's a more efficient way to code
it) at the end of this post. I hope that's all the code you need. I only
handle the Closing and Load events for the form, so I don't this this would
be a problem.
Thanks
ThunderMusic
Private Sub FRMMain_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If Not m_ClosingApp Then
e.Cancel = True
Me.Visible = False
Me.ShowInTaskbar = False
End If
End Sub
Private Sub NIMS_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles NIMS.DoubleClick
Me.Visible = True
Me.ShowInTaskbar = True
If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Normal
End If
End Sub
Private Sub MNUOpen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MNUOpen.Click
Me.Visible = True
Me.ShowInTaskbar = True
If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Normal
End If
End Sub
Private Sub MNUExit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MNUExit.Click
m_ClosingApp = True
Me.Close()
End Sub
private m_ClosingApp as boolean
I'm trying to have a MSN Messenger like form/app closing behavior. When I
click on the X button, I only want the form to disappear and when I
double-click on the notify icon or right-click on it and choose Open from
the context menu, I want the form to reappear. For that, I got the point
covered. Even when the form is minimize, the behavior is like MSN Messenger.
But one problem arose. When I close the form (the first time), it disappears
(that is ok), but after that, when I open it again, it appears, then if I
try to close it (for the second time), it disappears then reappears
immediately, if I close it again (for a third time), then, it disappears...
In fact, except for the first time I close it, I have to close it twice...
I supplied the the code I use (maybe there's a more efficient way to code
it) at the end of this post. I hope that's all the code you need. I only
handle the Closing and Load events for the form, so I don't this this would
be a problem.
Thanks
ThunderMusic
Private Sub FRMMain_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If Not m_ClosingApp Then
e.Cancel = True
Me.Visible = False
Me.ShowInTaskbar = False
End If
End Sub
Private Sub NIMS_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles NIMS.DoubleClick
Me.Visible = True
Me.ShowInTaskbar = True
If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Normal
End If
End Sub
Private Sub MNUOpen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MNUOpen.Click
Me.Visible = True
Me.ShowInTaskbar = True
If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Normal
End If
End Sub
Private Sub MNUExit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MNUExit.Click
m_ClosingApp = True
Me.Close()
End Sub
private m_ClosingApp as boolean