typedef struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG;
Parameters
-
hwnd
-
Identifies the window whose window procedure receives the message.
确定哪个窗口的消息句柄。
message
-
Specifies the message number.
确定消息号。
wParam
-
Specifies additional information about the message. The exact meaning depends on the value of the message member.
额外消息(重要)。
lParam
-
Specifies additional information about the message. The exact meaning depends on the value of the message member.
额外消息(重要)。
time
-
Specifies the time at which the message was posted.
确定发送的时间。
pt
-
Specifies the cursor position, in screen coordinates, when the message was posted.
确定鼠标点击的坐标位置,x,y。
-
对wParam和lParam的举例:
-
#define WM_CREATE 0x0001
- 它是1号消息,在窗口被创建的时候回发送这个1号消息。
-
Parameters
-
wParam
-
This parameter is not used.
这个没有被使用。
lParam
-
A pointer to a CREATESTRUCT structure that contains information about the window being created.
lParam指向一个被创建的窗口信息的结构体CREATESTRUCT 。
typedef struct tagCREATESTRUCT { LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCTSTR lpszName; LPCTSTR lpszClass; DWORD dwExStyle; } CREATESTRUCT, *LPCREATESTRUCT;
Members
-
lpCreateParams
-
Type: LPVOID
-
Contains additional data which may be used to create the window. If the window is being created as a result of a call to the CreateWindow or CreateWindowEx function, this member contains the value of the lpParam parameter specified in the function call.
If the window being created is a MDI client window, this member contains a pointer to a CLIENTCREATESTRUCT structure. If the window being created is a MDI child window, this member contains a pointer to an MDICREATESTRUCT structure.
If the window is being created from a dialog template, this member is the address of a SHORT value that specifies the size, in bytes, of the window creation data. The value is immediately followed by the creation data. For more information, see the following Remarks section.
hInstance
-
Type: HINSTANCE
-
A handle to the module that owns the new window.
一个指向拥有这个窗口的实例句柄。
hMenu
-
Type: HMENU
-
A handle to the menu to be used by the new window.
指向这个窗口的菜单的句柄。
hwndParent
-
Type: HWND
-
A handle to the parent window, if the window is a child window. If the window is owned, this member identifies the owner window. If the window is not a child or owned window, this member is NULL.
指向父窗口的句柄,如果这个窗口是子窗口。
cy
-
Type: int
-
The height of the new window, in pixels.
窗口的高度,单位像素。
cx
-
Type: int
-
The width of the new window, in pixels.
窗口宽度,单位像素。
y
-
Type: int
-
The y-coordinate of the upper left corner of the new window. If the new window is a child window, coordinates are relative to the parent window. Otherwise, the coordinates are relative to the screen origin.
Y坐标,是以窗口左上角开始算的。如果,它是一个子窗口,那么坐标以父窗口为参考,否则,以屏幕为参考。
x
-
Type: int
-
The x-coordinate of the upper left corner of the new window. If the new window is a child window, coordinates are relative to the parent window. Otherwise, the coordinates are relative to the screen origin.
X坐标,是以窗口左上角开始算的。如果,它是一个子窗口,那么坐标以父窗口为参考,否则,以屏幕为参考。
style
-
Type: LONG
-
The style for the new window. For a list of possible values, see Window Styles.
指向窗口分格。
lpszName
-
Type: LPCTSTR
-
The name of the new window.
新窗口的名字。
lpszClass
-
Type: LPCTSTR
-
A pointer to a null-terminated string or an atom that specifies the class name of the new window.
以一个空字符结尾的一个指向一个窗口类名的指针。
dwExStyle
-
Type: DWORD
-
The extended window style for the new window. For a list of possible values, see Extended Window Styles.
窗口扩展风格。
-
-
-