The process of finding the form of the onkeyDown event in the VC

xiaoxiao2021-03-06  69

First of all, I know that the VC is created by CREATEWINDOW to create a form, then find the createWindow () function from the MSN, get the address:

Ms-help: //ms.msdnqtr.2003feb.2052/winui/winui/windowsuserinterface/windowing/Windows/WindowReference/WindowFunctions/CreateWindow.htm.

HWND CREATEWINDOW

LPCTSTR LPCLASSNAME,

LPCTSTR LPWINDOWNAME,

DWORD DWSTYLE,

INT X,

Int Y,

Int nwidth,

Int nheight,

HWND HWNDPARENT,

Hmenu Hmenu,

Hinstance hinstance,

LPVOID LPPARAM

);

So, where is my form of message processing? In the description of LPClassName, tell us another function: registerclass (), then see the register's instructions:

Atom RegisterClass

Const wndclass * lpwndclass

);

What is WNDCLASS?

Typedef struct {

Uint style;

WndProc lpfnwndproc;

Int cbclsextra;

Int Cbwndextra;

Hinstance hinstance;

Hicon Hicon;

Hcursor hcursor;

Hbrush Hbrbackground;

LPCTSTR LPSZMENUNAME;

LPCTSTR LPSZCLASSNAME;

} WNDCLASS, * PWNDCLASS;

LPFNWNDPROC's description:

Point the window processing. You must use CallWindowProc to call the window handling process, more information, see WindowProc.

So let's take a look at CallWindowProc:

LResult CallWindowProc

WndProc LPPREVWNDFUNC,

HWND HWND,

UINT MSG,

WPARAM WPARAM,

LParam LPARAM

);

By way of explanation, we can see that CallWindowProc is usually used to specify the message processing process of the child form. However, there is an example: Subclassing a window. Take a look at the title is Using Window Procdurate, huh, this process is quite detailed:

MS-help: //ms.msdnqtr.2003feb.2052/winui/winui/windowsuserinterface/windowing/windowprocedures/USINGWINDOPROCEDURES.HTM.

Take a look at WindowProc:

LResult Callback WindowProc

HWND HWND,

UINT UMSG,

WPARAM WPARAM,

LParam LPARAM

);

This is the format of the message processing function you need to be defined.

However, there is still no message to find the button for the button. Then try to find Message, Message Object, etc. in the index, UINT also saw it. Remember to have WM_, then try, look, it seems to be based on MFC, I want to give up, but I see WM_Paint, I think this should have not used MFC, holding a hope, enter WM_K ......, ha ha, see WM_KEYDOWN, click to see WM_KEYDOWN Notification Windows Management in (): ms-help: //MS.MSDNQTR.2003FEB.2052/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputmessages/wm_keydown .htm, this title is WM_KeyDown Notification.

WM_KEYDOWN

WPARAM WPARAM

LParam Lparam;

Take a look at WM_KeyDown, do you understand some, anyway, I am.

Especially after seeing Keybord Input Preview in See Also, I feel that my Win32 programming is really too bad. I have learned to learn.

转载请注明原文地址:https://www.9cbs.com/read-88891.html

New Post(0)