新聞中心

        EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應用 > WinCE第一個程序 “hello world”

        WinCE第一個程序 “hello world”

        作者: 時間:2016-09-12 來源:網(wǎng)絡(luò) 收藏

        開發(fā)平臺VS2005+NewQoMobileSDK

        本文引用地址:http://www.104case.com/article/201609/303404.htm

        第一個問題,如何改變NewQoMobileSDK模擬器的大小?

        可以在vs2005上找到設(shè)備旁的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);

        }

        最終運行的結(jié)果:

        WinCE第一個程序wbr>“hellowbr>world”


        關(guān)鍵詞: WinCE

        評論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉
        主站蜘蛛池模板: 宣武区| 安吉县| 长兴县| 翁源县| 汽车| 德钦县| 清水河县| 常德市| 鄯善县| 南昌县| 茶陵县| 沙田区| 三都| 广饶县| 巨野县| 林芝县| 江城| 宁海县| 锡林郭勒盟| 镇雄县| 阿图什市| 正蓝旗| 龙胜| 衡山县| 盘山县| 麟游县| 大渡口区| 岳阳县| 伊宁县| 习水县| 商水县| 宁蒗| 大安市| 同心县| 屏边| 运城市| 宜春市| 兴业县| 邻水| 庄浪县| 永清县|