|
-
Sep 5th, 2001, 01:11 AM
#1
Thread Starter
New Member
Changing the functionality of Close button
Hi everybody,
This is my first post in this forum, and i hope that this will help me out of my problems.
I have an application which i put in the system tray. Now i want this application to have just the Close(X) button. And on close i want to put the application back to system tray. I know that i can disable the Minimixe and Maximixe buttons. But on close how do i put it to system tray. So far what i have achieved is, I'm able to disable the Maximixe button, and with a little of code i've been able to diable the close(X) button too. And now i have just the Minimize(-) button, which on click will put the application into system tray. I want to chiave this in close(X) button instead.
Please help me out. Code examples will be very helpful
-
Sep 5th, 2001, 01:22 AM
#2
Fanatic Member
This is one way to do it:
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'see if the person used the X, pressed Alt+F4, or selected Close from the control menu
If UnloadMode = vbFormControlMenu Then
'if so, do your things here that you need to do
'stop the unloading by giving Cancel a nonzero value
Cancel = True
End If
End Sub
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
-
Sep 5th, 2001, 01:22 AM
#3
As fare as I recall, the close button fires the Query_Unload event for the form, and in this event you can cancel the close procedure. You can also but code here, that places the form in the sys-tray.
-
Sep 5th, 2001, 01:48 AM
#4
Addicted Member
use this in your form queryunload event:
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormControlMenu Then '
'The user chose the Close command from the Control menu on the form.
pMinimizeToTray
Cancel = True
End If
End Sub
for the function pMinimizeToTray you can find examples on this site.
hth.
calle
-
Sep 5th, 2001, 03:08 AM
#5
Fanatic Member
Why did you just repeat exactly what I said?
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
-
Sep 5th, 2001, 08:26 AM
#6
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|