Click here to Skip to main content
15,893,190 members
Home / Discussions / C#
   

C#

 
QuestionProblems with VB 6.0 App loading .net assembly with own mdi window (message loop)... Pin
Chris Richner2-Feb-06 6:26
Chris Richner2-Feb-06 6:26 
QuestionSorting? algorithm Pin
criz84262-Feb-06 6:17
criz84262-Feb-06 6:17 
AnswerRe: Sorting? algorithm Pin
Paddy Boyd2-Feb-06 6:26
Paddy Boyd2-Feb-06 6:26 
GeneralRe: Sorting? algorithm Pin
criz84262-Feb-06 6:35
criz84262-Feb-06 6:35 
AnswerRe: Sorting? algorithm Pin
Guffa2-Feb-06 6:44
Guffa2-Feb-06 6:44 
GeneralRe: Sorting? algorithm Pin
criz84262-Feb-06 7:15
criz84262-Feb-06 7:15 
GeneralRe: Sorting? algorithm Pin
Guffa2-Feb-06 10:46
Guffa2-Feb-06 10:46 
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 

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.