Click here to Skip to main content
15,891,375 members
Articles / Programming Languages / C#
Article

Windows Message ID constants

Rate me:
Please Sign up or sign in to vote.
4.93/5 (72 votes)
22 Apr 2002 249.6K   3.7K   62   37
C# enumeration with most standard Windows message ID constants

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.

C#
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


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralNice! Pin
Yakumo Fujii3-Jul-05 19:25
Yakumo Fujii3-Jul-05 19:25 
GeneralThank You Pin
r a n a6-Apr-05 19:03
r a n a6-Apr-05 19:03 
GeneralThanks Pin
bkalicharan18-Sep-04 14:08
bkalicharan18-Sep-04 14:08 
GeneralThank's Pin
gomess4-Apr-04 7:26
gomess4-Apr-04 7:26 
GeneralJust what I needed, thanks! Pin
DonDavis15-Jan-04 9:44
DonDavis15-Jan-04 9:44 
Generallose SC_CLOSE,SC_MOVE,SC_MAXIMIZE,SC_MINIMIZE,SC_SIZE! Pin
langmu liu10-Sep-03 16:33
langmu liu10-Sep-03 16:33 
GeneralRe: lose SC_CLOSE,SC_MOVE,SC_MAXIMIZE,SC_MINIMIZE,SC_SIZE! Pin
Anonymous7-Sep-04 1:01
Anonymous7-Sep-04 1:01 
GeneralRe: lose SC_CLOSE,SC_MOVE,SC_MAXIMIZE,SC_MINIMIZE,SC_SIZE! Pin
gdbjohnson26-Nov-04 10:17
gdbjohnson26-Nov-04 10:17 
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 <br />
	{<br />
		SC_FIRST = 0xF000,<br />
		SC_SIZE = SC_FIRST, //	Sizes the window.<br />
		SC_MOVE = SC_FIRST + 0x10, //	Moves the window.<br />
		SC_MINIMIZE = SC_FIRST + 0x20, //	Minimizes the window.<br />
		SC_MAXIMIZE = SC_FIRST + 0x30, //	Maximizes the window.<br />
		SC_NEXTWINDOW = SC_FIRST + 0x40, //	Moves to the next window.<br />
		SC_PREVWINDOW = SC_FIRST + 0x50, //	Moves to the previous window.<br />
		SC_CLOSE = SC_FIRST + 0x60, //		Closes the window.<br />
		SC_VSCROLL = SC_FIRST + 0x70, //Scrolls vertically<br />
		SC_HSCROLL = SC_FIRST + 0x80, //	Scrolls horizontally.<br />
		SC_MOUSEMENU = SC_FIRST + 0x90, //	Retrieves the window menu as a result of a mouse click.<br />
		SC_KEYMENU = SC_FIRST + 0x100, //	Retrieves the window menu as a result of a keystroke. For more information, see the Remarks section.<br />
		SC_ARRANGE = SC_FIRST + 0x110, <br />
		SC_RESTORE = SC_FIRST + 0x120, //	Restores the window to its normal position and size.<br />
		SC_TASKLIST = SC_FIRST + 0x130, //	Activates the Start menu.<br />
		SC_SCREENSAVE = SC_FIRST + 0x140, //	Executes the screen saver application specified in the [boot] section of the System.ini file.<br />
		SC_HOTKEY = SC_FIRST + 0x150, //Activates the window associated with the application-specified hot key. The lParam parameter identifies the window to activate.<br />
<br />
<br />
		SC_DEFAULT = SC_FIRST + 0x160, //	Selects the default item; the user double-clicked the window menu.<br />
		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. <br />
											//The lParam parameter can have the following values:<br />
											//1 - the display is going to low power<br />
											//2 - the display is being shut off<br />
		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.<br />
		<br />
		SC_SEPARATOR = 0xF00F<br />
	}

GeneralRe: lose SC_CLOSE,SC_MOVE,SC_MAXIMIZE,SC_MINIMIZE,SC_SIZE! Pin
Nasenbaaer27-Jul-07 6:05
Nasenbaaer27-Jul-07 6:05 
GeneralThank you a lot! Pin
Phan Nguyen19-Jun-03 19:20
Phan Nguyen19-Jun-03 19:20 
GeneralExtremely useful for C# coders who don't have VC++ Pin
Nish Nishant18-Sep-02 15:16
sitebuilderNish Nishant18-Sep-02 15:16 
Generalenum declaration Pin
Olaf Herrmann23-Apr-02 22:15
professionalOlaf Herrmann23-Apr-02 22:15 
GeneralRe: enum declaration Pin
Anthony Baraff24-Apr-02 1:47
Anthony Baraff24-Apr-02 1:47 
GeneralRe: enum declaration Pin
24-Apr-02 8:11
suss24-Apr-02 8:11 
GeneralRe: enum declaration Pin
Anthony Baraff24-Apr-02 10:17
Anthony Baraff24-Apr-02 10:17 
GeneralRe: enum declaration Pin
Armen Hakobyan27-May-02 1:20
professionalArmen Hakobyan27-May-02 1:20 
Generalthanks mate Pin
23-Apr-02 8:27
suss23-Apr-02 8:27 

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.