读书人

MFC窗口有关问题

发布时间: 2012-01-08 22:48:50 作者: rapoo

MFC窗口问题
#include <windows.h>
#include <stdio.h>

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

int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
WNDCLASS ra;
ra.cbClsExtra = 0;
ra.cbWndExtra = 0;
ra.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
ra.hCursor = LoadCursor(NULL,IDC_CROSS);
ra.hIcon = LoadIcon(NULL,IDI_ERROR);
ra.hInstance = hInstance;
ra.lpfnWndProc = WinRacProc;
ra.lpszClassName = "rach";
ra.lpszMenuName = NULL;
ra.style = CS_HREDRAW | CS_VREDRAW;

RegisterClass(&ra);
HWND hwnd;
hwnd = CreateWindow("rach","racWin",WS_OVERLAPPEDWINDOW,
0,0,600,500,NULL,NULL,hInstance,NULL);

ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);

MSG msg;
while(GetMessage(&msg,NULL,0,0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return 0;
}
用的是VC6.0编译后出现不了窗口,是什么问题

[解决办法]
一步一步去调试吧
[解决办法]
你消息都还没有写完吧,callback里的不用实现吗?
[解决办法]

探讨
你消息都还没有写完吧,callback里的不用实现吗?

[解决办法]
C/C++ code
wndcls.lpfnWndProc        = ::DefWindowProc; 

读书人网 >VC/MFC

热点推荐