VS2005创建一个WinCE的应用程序

来源:互联网 发布:mac 安装hadoop 编辑:程序博客网 时间:2024/05/16 11:49

首先要确认以下条件必须满足:

(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环境运行的可执行文件了
原创粉丝点击