VS2005創建一個WinCE的應用程序

首先要確認以下條件必須滿足:

(1)有可用的SDK

  (2)  VS2005(也可以使用EVC,只要安裝了對應版本的SDK就行)

(3)在新建的project中選擇正確的SDK。

創建步驟:

(1)打開VS2005;File->new->project...

         出現 New Project 對話框

         在project types中選擇Smart Device工程類型;在Templates中選擇Win32 Smart Device Project模板;

         project名和Solution名可以任意輸入。

 (2)按Ok進入下一個對話框,再按next進入下一個對話框;

          從已裝的SDK中,選擇你需要的SDK。

  (3)按Finsh

    (4) 在WinMain()中加了“hello world”

// hello.cpp : 定義應用程序的入口點。
//

#include "stdafx.h"
#include "hello.h"
#include <windows.h>
#include <commctrl.h>

#define MAX_LOADSTRING 100

// 全局變量:
HINSTANCE   g_hInst;   // 當前實例
#ifdef SHELL_AYGSHELL
HWND    g_hWndMenuBar;  // 菜單欄句柄
#else // SHELL_AYGSHELL
HWND    g_hWndCommandBar; // 命令欄句柄
#endif // SHELL_AYGSHELL

// 此代碼模塊中包含的函數的前向聲明:
ATOM   MyRegisterClass(HINSTANCE, LPTSTR);
BOOL   InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
{
 MSG msg;

 // 執行應用程序初始化:
 if (!InitInstance(hInstance, nCmdShow))
 {
  return FALSE;
 }

 HACCEL hAccelTable;
 hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_HELLO));
 
 MessageBox(NULL, TEXT("Hello World!"), TEXT("hello"), MB_OK);


 // 主消息循環:
 while (GetMessage(&msg, NULL, 0, 0))
 {
  if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  {
   TranslateMessage(&msg);
   DispatchMessage(&msg);
  }
 }

 return (int) msg.wParam;
}

 

( 5 ) 注意你vs2005上方的:如圖,選擇的是release和armv4

(6)生成hello後
(7)在工程目錄下release文件中會生成一個我們想要的wince環境運行的可執行文件了
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章