窗口回调函数

1.传参

/*
WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
和
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG, *PMSG;

前四个参数一致

操作系统直接使用msg前四位作为参数传入窗口回调函数
*/

2.返回值(必须返回,会被作为dispatchmessage函数的返回值)

The return value specifies the result of the message processing and depends on the message sent. 

返回值指定消息处理的结果,并取决于所发送的消息。

     //此处分发消息,调用消息回调函数,
        //同时消息回调函数的返回值作为DIspatchMessage的返回值返回,
        //一般讲这个返回值忽略
        DispatchMessage(&msg);
        /*
        The return value specifies the value returned by the window procedure. Although its meaning depends on the message being dispatched, the return value generally is ignored. 
        返回值指定窗口过程返回的值。尽管它的含义依赖于发送的消息,但是返回值通常被忽略。
        */

所以说在窗口过程函数中的返回值必须要有

原文地址:https://www.cnblogs.com/ssyfj/p/8495295.html