谁有WndProc的详细资料啊

spatx 2004-08-10 02:29:46
中英文皆可。
在线等待
...全文
63 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
i_noname 2004-08-10
WindowProc
The WindowProc function is an application-defined function that processes messages sent to a window. The WNDPROC type defines a pointer to this callback function. WindowProc is a placeholder for the application-defined function name.

LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);

Parameters
hwnd
Handle to the window.
uMsg
Specifies the message.
wParam
Specifies additional message information. The contents of this parameter depend on the value of the uMsg parameter.
lParam
Specifies additional message information. The contents of this parameter depend on the value of the uMsg parameter.
Return Values
The return value is the result of the message processing and depends on the message sent.

回复
i_noname 2004-08-10
给你个"Hello World"WIN32程序中的一些代码
LRESULT CALLBACK WndProc( HWND hWnd , UINT message , WPARAM wParam , LPARAM lParam )
{
int wmId , wmEvent;
switch ( message )
{
case WM_COMMAND:
wmId = LOWORD( wParam ) ;
wmevent = HIWOORD( wParam ) ;
switch ( wmId )
{
case IDM_ABOUT:
DialogBox( _hInst, "About Box" , hWnd , (DLGPROC)About );
break;
case IDM_EXIT:
DestroyWindow( hWnd ) ;
break;
default:
return( DefWindowProc( hWnd , message , wParam , lParam ) ;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 ) ;
break;
default:
return( DefWindowProc( hWnd , message , wParam , lParam ) ;
}
retrun( 0 ) ;
回复
spatx 2004-08-10
Syntax is what and Parameters?
参数和结构怎么都没有啊!
我的MSDN是2003的没有WndProc的
所以求助
回复
i_noname 2004-08-10
楼主还真是惜字如金,详细到哪方面啊?
this is copy from msdn.

Registering Window “Classes”
Home | Overview | How Do I | Tutorial

Window “classes” in traditional programming for Windows define the characteristics of a “class” (not a C++ class) from which any number of windows can be created. This kind of class is a template or model for creating windows.

Window Class Registration in Traditional Programs for Windows
In a traditional program for Windows, without MFC, you process all messages to a window in its “window procedure” or “WndProc.” A WndProc is associated with a window by means of a “window class registration” process. The main window is registered in the WinMain function, but other classes of windows can be registered anywhere in the application. Registration depends on a structure that contains a pointer to the WndProc function together with specifications for the cursor, background brush, and so forth. The structure is passed as a parameter, along with the string name of the class, in a prior call to the RegisterClass function. Thus, a registration class can be shared by multiple windows.

Window Class Registration in MFC Programs
In contrast, most window class registration activity is done automatically in an MFC framework program. If you are using MFC, you typically derive a C++ window class from an existing library class using the normal C++ syntax for class inheritance. The framework still uses traditional “registration classes,” and it provides several standard ones, registered for you in the standard application initialization function. You can register additional registration classes by calling the AfxRegisterWndClass global function and then passing the registered class to the Create member function of CWnd. As described here, the traditional “registration class” in Windows is not to be confused with a C++ class.
回复
相关推荐
发帖
VC/MFC
创建于2007-09-28

1.5w+

社区成员

VC/MFC相关问题讨论
申请成为版主
帖子事件
创建了帖子
2004-08-10 02:29
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……