求助wince helloword 错误
#include <Windows.h>#include <wingdi.h>
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
//创建一个窗体类
WNDCLASS ws;
ws.cbClsExtra = 0;
ws.cbWndExtra = 0;
ws.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
ws.hCursor = NULL;
ws.hIcon = NULL;
ws.hInstance = hInstance;
ws.lpfnWndProc = WndProc;
ws.lpszClassName = TEXT("test001");
ws.lpszMenuName = NULL;
ws.style = CS_VREDRAW | CS_HREDRAW;
//注册窗体
if(! RegisterClass(&ws)) return -1;
//创建窗体
HWND hwnd =CreateWindow (TEXT("test001"),TEXT("MyFirstWindows"),WS_VISIBLE | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION,
10,10,400,300,
NULL,NULL,hInstance,NULL);
//更新窗体内容
UpdateWindow(hwnd);
ShowWindow(hwnd,nCmdShow);
MSG msg;
//获取系统消息
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 1;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
GetClientRect(hwnd,&rect);
if (message == WM_DESTROY)
{
PostQuitMessage(1);
}
if (message == WM_PAINT)
{
hdc=BeginPaint(hwnd,&ps);
DrawText(hdc,TEXT("test001"),-1,&rect,DT_VCENTER | DT_CENTER);
EndPaint(hwnd,&ps);
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
1>.\test001.cpp(7) : error C2731: 'WinMain' : function cannot be overloaded
1> .\test001.cpp(6) : see declaration of 'WinMain'
1>Build log was saved at "file://e:\OK6410\test001\test001\NewQoMobileSDK (ARMV4I)\Debug\BuildLog.htm"
1>test001 - 1 error(s), 0 warning(s) 这位朋友,建议贴一些自己分析和操作的过程。方便和大家一起交流
页:
[1]