|
-
Dec 3rd, 2003, 11:45 AM
#1
Thread Starter
Addicted Member
Capture when user click the X on the form
Is there a way to capture the event when a user click on the X button on the top right corner of a form? I want to do something with the event when a user click on the X on the form. However, I could not figure out how to capture that.
Any help is appreciated!
ljCharlie
-
Dec 3rd, 2003, 11:51 AM
#2
like this ...
VB Code:
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = 161 Then
If m.WParam.ToInt32 = 20 Then
MessageBox.Show("you just clicked the X button!")
End If
End If
MyBase.WndProc(m)
End Sub
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Dec 3rd, 2003, 02:24 PM
#3
Addicted Member
Ok this is kinda off the topic question but, where do you guys find this stuff?
Like:
m.Msg = 161
and
m.WParam.ToInt32 = 20
What is 161 and 20?
Where is the defenition of these numbers?
Just for future reference
-
Dec 3rd, 2003, 02:29 PM
#4
Thread Starter
Addicted Member
Thanks a bunch, dynamic_sysop! It works, but yes, Hole-In-One, you're right.
Where do you guys find this stuff?
ljCharlie
-
Dec 3rd, 2003, 03:50 PM
#5
trial and error , i tend to try stuff like clicking on the toolbox of a form , then outputing the windows messages ( m.msg ) to Console.WriteLine
same with the wparams etc...
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Dec 3rd, 2003, 03:52 PM
#6
Thread Starter
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
|