Hi,
I read this line in creating window example with win32 API:
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
please, can someone explain it to me..!
i googled but i can't find enough explanation
regards
iammfa
Hi,
I read this line in creating window example with win32 API:
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
please, can someone explain it to me..!
i googled but i can't find enough explanation
regards
iammfa
Here is an article explaining CALLBACK functions (good article I actually learned a lot)
http://www.codeguru.com/cpp/cpp/cpp_mfc/callbacks/article.php/c10557/
Chapter #3 in Petzold's, "Programming Windows 5th Edition" explains a lot about windows creation and message handling. According to Petzold (p. 62):
A window's procedure is always defined like this:
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
The four parameters to the window procedure are identical to the first four fields of the MSG structure. The first parameter is hwnd, the handle to the window receiving the message.....
The second parameter is the same as the same as the message field in the MSG structure. It's a number that identifies the message....
Suprisingly, Petzold doesn't go into detail about the WPARAM and LPARAM arguments, but begins to give example code of how to process these as windows messages.
Here is what the MSG struct looks like:
typedef struct {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG, *PMSG;
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.