Hi, all
I am very new in this field. I am learning the tutorial by this URL:
http://www.pocket-g.com/prx/winframe.html
///////////////////////////////////////////////
#include <windows.h>
LRESULT MainWndProc(HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hDC;
RECT rcClient;
switch(message){
case WM_PAINT:
hDC = BeginPaint(hWnd,&ps);
GetClientRect(hWnd,&rcClient);
DrawText(hDC,L"Hello",5,&rcClient,DT_CENTER|DT_VCENTER);
EndPaint(hWnd,&ps);
break;
case WM_LBUTTONDOWN:
DestroyWindow(hWnd);
break;
default:
DefWindowProc(hWnd, message, uParam, lParam);
}
return 0;
}
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc;
memset(&wc,0,sizeof(wc));
wc.style = CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) MainWndProc;
wc.hInstance = hInstance;
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
wc.lpszClassName = L"myapp";
if(RegisterClass(&wc))
{
HWND hWndMain;
if(hWndMain = CreateWindow(L"myapp",L"Hello",WS_VISIBLE,0,0,240,320,0,0,hInstance,0))
{
MSG msg;
ShowWindow(hWndMain, SW_MAXIMIZE);
UpdateWindow(hWndMain);
while(GetMessage(&msg,hWndMain,0,0))
DispatchMessage(&msg);
return msg.wParam;
}
}
return 0;
}
/////////////////////////////////////
The code is very simple. But when I build it, after the simulator emerged, an error message is prompt which said:
The Intelnet 80486 CPU does not support the configuaration example1 - Win32 (WCE ARM) Release!
Executable will not run on the device.
example1 is the project name I created.
The configuarations are:
Pocket PC 2002 Win32 (WCE ARM) Release Pocket PC 2002 Emulation
I tried to choose
Win32 (WCE x86) instead but get errors when compiling:
Compiling...
startup.c
C:\ppc\example1\startup.c(2 : warning C4007: 'WinMain' : must be '__stdcall'
C:\ppc\example1\startup.c(2 : error C2373: 'WinMain' : redefinition; different type modifiers
C:\Windows CE Tools\wce300\Pocket PC 2002\include\winbase.h(372) : see declaration of 'WinMain'
Error executing cl.exe.
startup.obj - 1 error(s), 1 warning(s)
Could any one give me a help? Any suggestion?
Many, many, many,... thanks!!!!!
Xiaobo