Click here to Skip to main content
15,886,578 members
Home / Discussions / C#
   

C#

 
GeneralRe: Sorting? algorithm Pin
criz84262-Feb-06 12:26
criz84262-Feb-06 12:26 
AnswerRe: Sorting? algorithm Pin
Guffa2-Feb-06 21:43
Guffa2-Feb-06 21:43 
QuestionHow did the user close the form? Pin
Chals2-Feb-06 4:45
Chals2-Feb-06 4:45 
AnswerRe: How did the user close the form? Pin
malharone2-Feb-06 5:42
malharone2-Feb-06 5:42 
GeneralRe: How did the user close the form? Pin
Chals2-Feb-06 5:45
Chals2-Feb-06 5:45 
GeneralRe: How did the user close the form? Pin
Dave Kreskowiak2-Feb-06 5:48
mveDave Kreskowiak2-Feb-06 5:48 
GeneralRe: How did the user close the form? Pin
Chals2-Feb-06 6:23
Chals2-Feb-06 6:23 
GeneralRe: How did the user close the form? Pin
microsoc2-Feb-06 22:16
microsoc2-Feb-06 22:16 
hi chals! Smile | :)

try this:
private const int WM_SYSCOMMAND = 0x112; 
private const int SC_CLOSE = 0xF060;

protected override void WndProc(ref Message m)
{
     if (m.Msg == WM_SYSCOMMAND && m.WParam.ToInt32() == SC_CLOSE)
     {
          //do something here
     }
}


messages under WM_SYSCOMMAND includes:
- Restore, Move, Size, Minimize, Maximize & Close (x button in the forms) or the commands in the context menu when you right click the title bar of a window.

the SC_CLOSE WParam is for the close command.

you can look for other commands in the WinUser.h file of Visual Studios. most of the time it is in "C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\" folder. It has the list of constants for API commands.

hope that helps! Smile | :)

microsoc Cool | :cool:
GeneralRe: How did the user close the form? Pin
Chals6-Feb-06 6:37
Chals6-Feb-06 6:37 
GeneralRe: How did the user close the form? Pin
microsoc6-Feb-06 14:19
microsoc6-Feb-06 14:19 
QuestionUpdating MenuItems (vs2005) Pin
Mark062-Feb-06 4:41
Mark062-Feb-06 4:41 
AnswerRe: Updating MenuItems (vs2005) Pin
Mark062-Feb-06 4:50
Mark062-Feb-06 4:50 
GeneralRe: Updating MenuItems (vs2005) Pin
malharone2-Feb-06 5:43
malharone2-Feb-06 5:43 
QuestionTransparent Color in a Picture Box Pin
MarkMokris2-Feb-06 4:39
MarkMokris2-Feb-06 4:39 
AnswerRe: Transparent Color in a Picture Box Pin
Dave Kreskowiak2-Feb-06 5:47
mveDave Kreskowiak2-Feb-06 5:47 
AnswerRe: Transparent Color in a Picture Box Pin
Soundman32.22-Feb-06 21:41
Soundman32.22-Feb-06 21:41 
Questiontransparent label over textbox Pin
melanieab2-Feb-06 4:36
melanieab2-Feb-06 4:36 
AnswerRe: transparent label over textbox Pin
Dave Kreskowiak2-Feb-06 5:46
mveDave Kreskowiak2-Feb-06 5:46 
QuestionUnhandled exception Pin
joly_12-Feb-06 4:25
joly_12-Feb-06 4:25 
AnswerRe: Unhandled exception Pin
malharone2-Feb-06 5:45
malharone2-Feb-06 5:45 
GeneralRe: Unhandled exception Pin
joly_12-Feb-06 5:52
joly_12-Feb-06 5:52 
GeneralRe: Unhandled exception Pin
malharone2-Feb-06 6:30
malharone2-Feb-06 6:30 
GeneralRe: Unhandled exception Pin
Kevin McFarlane2-Feb-06 6:33
Kevin McFarlane2-Feb-06 6:33 
GeneralRe: Unhandled exception Pin
joly_12-Feb-06 7:11
joly_12-Feb-06 7:11 
GeneralRe: Unhandled exception Pin
User 66582-Feb-06 6:45
User 66582-Feb-06 6:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.