windows程序设计 窗口过程函数

来源:互联网 发布:华为手机游戏数据 编辑:程序博客网 时间:2024/06/05 18:26

The Window Procedure

In HELLOWIN,the window procedure is the function named WndProc. A window procedure can haveany name (as long as it doesn't conflict with some other name, of course). AWindows program can contain more than one window procedure. A window procedureis always associated with a particular window class that you register by callingRegisterClass. The CreateWindowfunction creates a window based on a particularwindow class. More than one window can be created based on the same windowclass.

 

In HELLOWIN,the window procedure is the function named WndProc. A window procedure can haveany name (as long as it doesn't conflict with some other name, of course). AWindows program can contain more than one window procedure. A window procedureis always associated with a particular window class that you register by callingRegisterClass. The CreateWindowfunction creates a window based on a particularwindow class. More than one window can be created based on the same windowclass. A window procedure is always defined like this:

LRESULT CALLBACK WndProc (HWND hwnd,UINT message, WPARAM wParam, LPARAM lParam)

If a programcreates multiple windows based on the same window class (and hence the samewindow procedure), hwndidentifies the particular window receiving the message.

Programsgenerally don't call window procedures directly. The window procedure is almostalways called from Windows itself. A program can indirectly call its own windowprocedure by calling a function named SendMessage, which we'll examine in laterchapters.

0 0