WinCE第一个程序 “hello world”
开发平台VS2005+NewQoMobileSDK
第一个问题,如何改变NewQoMobileSDK模拟器的大小?
可以在vs2005上找到设备旁的OPTION,进入后选择properties,然后选择 Emulator option 然后可以自己改变模拟器的大小了。
源代码:
#include
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
int WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS wc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.hCursor = NULL;
wc.hIcon = NULL;
wc.hInstance = hInstance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = TEXT(hello);
wc.lpszMenuName = NULL;
wc.style = CS_HREDRAW | CS_VREDRAW;
if (!RegisterClass(wc)) return -1;
HWND hWnd = CreateWindow(TEXT(hello),TEXT(helloworld), WS_VISIBLE | WS_BORDER | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_CAPTION,
10,10,320,240,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(hello world),-1,rect,DT_VCENTER | DT_CENTER);
EndPaint(hWnd,ps);
}
return DefWindowProc(hWnd,message,wParam,lParam);
}
最终运行的结果:
![WinCE第一个程序wbr>“hellowbr>world”](../img/eep/emb/emb-48947kgqr3ign3vl.gif)
WinCE 相关文章:
- 如何使WINCE启动时自动运行应用程序(04-11)
- 基于WinCE操作系统的通用USB数控键盘设计(08-05)
- 基于WinCE的ARM视频监控系统(11-14)
- WinCE系统下BootLoader的开发(04-10)
- WinCE下光电编码器的驱动程序设计(04-12)
- WindowsCE.Net下CAN卡的驱动程序设计(04-12)