not enough actual parameters for macro 'CreateWindowA'解决办法

not enough actual parameters for macro 'CreateWindowA'
本帖最后由 VisualEleven 于 2013-06-17 10:48:24 编辑
#include<windows.h>
#include<stdio.h>
LRESULT CALLBACK WindowProc
(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain
(
 HINSTANCE hInstance,
 HINSTANCE hPrevInstance,
 LPSTR IpCmdLine,
 int nCmdShow
 )
{
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);
wndcls.hIcon=LoadIcon(NULL,IDI_ERROR);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=WindowProc;
wndcls.lpszClassName="liquanfu2009";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_HREDRAW |CS_VREDRAW;

RegisterClass(&wndcls);

HWND hwnd;
hwnd=CreateWindow("liquanfu2009","我的窗口",WS_OVERLAPPEDWINDOW,0,0,600,400,NULL,hInstance,NULL);//这里错了not enough actual parameters for macro 'CreateWindowA'
ShowWindow(hwnd,SW_SHOWNORNAL);
UpdateWindow(hwnd);

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

}
////////
LRESULT CALLBACK Windowproc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf(szChar,"char code is %d",wParam);
MessageBox(hwnd,szChar,"char",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"mouse clicked","message",0);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,0,50,"My window",strlen("My window"));
ReleaseDC(hwnd,hdc);
break;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC=BeginPaint(hwnd,&ps);
TextOut(hDC,0,0,"My program",strlen("My program"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
         if(IDYES==MessageBox(hwnd,"do you qiut?","message",MB_YESNO)
 DestroyWindow(hwnd);
     break;
case WM_DESTROY:
PostQuitMessage(0);
     break;
default:
return DefWindowProc(hwnd,uMsg,WParam,lParam);
}
return 0;
}

------解决方案--------------------
hwnd=CreateWindow("liquanfu2009","我的窗口",WS_OVERLAPPEDWINDOW,0,0,600,400,NULL,NULL,hInstance,NULL);//这里错了not enough actual parameters for macro 'CreateWindowA'
------解决方案--------------------
SW_SHOWNORMAL