首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

MFC窗口有关问题

2012-01-08 
MFC窗口问题#include windows.h#include stdio.hLRESULT CALLBACK WinRacProc(HWND hwnd,// handle to

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; 

热点排行