一、填空
1、MFC库中负责应用程序管理的类是CWinApp而负责管理各种窗口的类是CWnd
2、Windows的所谓事件驱动的核心是消息
3、移动鼠标会产生的消息是WM_MOUSEMOVE
4、Windows系统中对各种对象(窗口、文件、资源等)的标识是句柄
5、用VC编写基于窗口的典型应用程序,可以使用的工具库有MFC和API函数库。
二、简答
1、MFC中产生消息映射表结构的宏有哪三个?
2、CWinApp类有什么作用?
3、简述PostMessage和SendMessage两个API函数的主要差别。
三、编程题
//可能用到的函数如下:
//BOOL ShowWindow( HWND hWnd, int nCmdShow);The ShowWindow function sets the specified window's show state.
//hWnd:[in] Handle to the window.
//nCmdShow:[in] Specifies how the window is to be shown.
//BOOL UpdateWindow(HWND hWnd // handle to window);
// 下面是要完成的函数
// FUNCTION: InitInstance(HINSTANCE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = 1、_hInstance__; // Store instance handle in our global variable
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
2、_ruturn_FALSE_;
}
3、ShowWindow(hWnd, nCmdShow);
4、UpdateWindow(hWnd);
5、return TRUE;
}