Click here to Skip to main content
Licence 
First Posted 22 Apr 2002
Views 164,126
Downloads 1,867
Bookmarked 56 times

Windows Message ID constants

By Anthony Baraff | 22 Apr 2002
C# enumeration with most standard Windows message ID constants
2 votes, 2.9%
1

2

3
7 votes, 10.1%
4
60 votes, 87.0%
5
4.92/5 - 77 votes
2 removed
μ 4.81, σa 1.28 [?]

Introduction

The .NET base classes manage to insulate the programmer from many of the details of how applications interact with the underlying operating system, but in order to implement advanced UI functionality Microsoft leaves you no option but to interoperate with windows plumbing. The IMessageFilter interface requires you to use the System.Windows.Forms.Message struct which wraps a windows message. The Msg property corresponds to an int value that stores a constant indicating the type of message, Windows is sending your application. To my knowledge, Microsoft has not incorporated an enumeration with the commonly used constants. So, I stripped all of the messages I could find in the CommCtrl.h and WinUser.h header files and created an enum. I hope that you find it useful.

namespace WindowsUtilities
{
    public enum WindowsMessages: int
    {
        WM_NULL = 0x0000,
        WM_CREATE = 0x0001,

        //Refer the WindowMessages.cs file
        //for complete source listing

        LM_SETITEM = (WM_USER + 0x302), 
        LM_GETITEM = (WM_USER + 0x303)
    }
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Anthony Baraff

Web Developer

United States United States

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralThank You PinmemberRana Ian20:03 6 Apr '05  
GeneralThanks Pinmemberbkalicharan15:08 18 Sep '04  
GeneralThank's Pinmembergomess8:26 4 Apr '04  
GeneralJust what I needed, thanks! PinmemberDonDavis10:44 15 Jan '04  
Generallose SC_CLOSE,SC_MOVE,SC_MAXIMIZE,SC_MINIMIZE,SC_SIZE! Pinmemberlangmu liu17:33 10 Sep '03  
GeneralRe: lose SC_CLOSE,SC_MOVE,SC_MAXIMIZE,SC_MINIMIZE,SC_SIZE! PinsussAnonymous2:01 7 Sep '04  
GeneralRe: lose SC_CLOSE,SC_MOVE,SC_MAXIMIZE,SC_MINIMIZE,SC_SIZE! Pinmembergdbjohnson11:17 26 Nov '04  
I'm relatively new to Windows API stuff (ie: disclaimer), but this could be a useful addendum to the above which I grabbed from MSDN and the WinUser.h file :
 
public enum WM_SYSCOMMAND_WPARAM
{
SC_FIRST = 0xF000,
SC_SIZE = SC_FIRST, // Sizes the window.
SC_MOVE = SC_FIRST + 0x10, // Moves the window.
SC_MINIMIZE = SC_FIRST + 0x20, // Minimizes the window.
SC_MAXIMIZE = SC_FIRST + 0x30, // Maximizes the window.
SC_NEXTWINDOW = SC_FIRST + 0x40, // Moves to the next window.
SC_PREVWINDOW = SC_FIRST + 0x50, // Moves to the previous window.
SC_CLOSE = SC_FIRST + 0x60, // Closes the window.
SC_VSCROLL = SC_FIRST + 0x70, //Scrolls vertically
SC_HSCROLL = SC_FIRST + 0x80, // Scrolls horizontally.
SC_MOUSEMENU = SC_FIRST + 0x90, // Retrieves the window menu as a result of a mouse click.
SC_KEYMENU = SC_FIRST + 0x100, // Retrieves the window menu as a result of a keystroke. For more information, see the Remarks section.
SC_ARRANGE = SC_FIRST + 0x110,
SC_RESTORE = SC_FIRST + 0x120, // Restores the window to its normal position and size.
SC_TASKLIST = SC_FIRST + 0x130, // Activates the Start menu.
SC_SCREENSAVE = SC_FIRST + 0x140, // Executes the screen saver application specified in the [boot] section of the System.ini file.
SC_HOTKEY = SC_FIRST + 0x150, //Activates the window associated with the application-specified hot key. The lParam parameter identifies the window to activate.
 

SC_DEFAULT = SC_FIRST + 0x160, // Selects the default item; the user double-clicked the window menu.
SC_MONITORPOWER = SC_FIRST + 0x170, // Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
//The lParam parameter can have the following values:
//1 - the display is going to low power
//2 - the display is being shut off
SC_CONTEXTHELP = SC_FIRST + 0x180, // Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.

SC_SEPARATOR = 0xF00F
}

GeneralRe: lose SC_CLOSE,SC_MOVE,SC_MAXIMIZE,SC_MINIMIZE,SC_SIZE! PinmemberNasenbaaer7:05 27 Jul '07  
GeneralThank you a lot! PinmemberPhan Nguyen20:20 19 Jun '03  
GeneralExtremely useful for C# coders who don't have VC++ PineditorNishant S16:16 18 Sep '02  
Generalenum declaration PinmemberOlaf Herrmann23:15 23 Apr '02  
GeneralRe: enum declaration PinmemberAnthony Baraff2:47 24 Apr '02  
GeneralRe: enum declaration PinmemberAnonymous9:11 24 Apr '02  
GeneralRe: enum declaration PinmemberAnthony Baraff11:17 24 Apr '02  
GeneralRe: enum declaration PinmemberArmen Hakobyan2:20 27 May '02  
Generalthanks mate PinmemberJeremy Pullicino9:27 23 Apr '02  

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

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120210.1 | Last Updated 23 Apr 2002
Article Copyright 2002 by Anthony Baraff
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid