注册 登录
编程论坛 VC++/MFC

CreateWindow

小无相 发布于 2013-04-03 14:16, 1231 次点击
#include <windows.h>
#include <stdio.h>
#include <tchar.h>


LRESULT CALLBACK WinHuangProc(
  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,          // command line
  int nCmdShow              // show state
)
{
    WNDCLASS wndcls;
    wndcls.cbClsExtra=0;
    wndcls.cbWndExtra=0;
    wndcls.hbrBackground=(HBRUSH) GetStockObject(BLACK_BRUSH);
    wndcls.hCursor=LoadCursor(NULL,IDC_ARROW);
    wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    wndcls.hInstance=hInstance;
    wndcls.lpfnWndProc=WinHuangProc;
    wndcls.lpszClassName=_T("Huang");
    wndcls.lpszMenuName=NULL;
    wndcls.style=CS_HREDRAW | CS_VREDRAW;


    RegisterClass(&wndcls);

    HWND hwnd;
    hwnd=CreateWindow(_T("Huang",_T("happy"),WS_OVERLAPPED,0,0,500,500,NULL,NULL,hInstance,NULL);//这个地方说错误地终止了宏调用,CreateWindow提示错误
    ShowWindow(hwnd,SW_SHOWNORMAL);



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

    return 0;
}

c:\users\huang\documents\visual studio 2010\projects\winmain\winmain\winmain.cpp(38): fatal error C1057: 宏扩展中遇到意外的文件结束
用的是visual studio 2010,整了半天了,急死了
3 回复
#2
小无相2013-04-03 14:31
发错了,想删帖,不知道咋删
#3
信箱有效2013-04-03 14:33
createwindow的参数是那样的吗 getmessage的参数是那样的吗
#4
小无相2013-04-03 14:42
尴尬了,
1