Windows CE 6.0 signalStart(初始选择应用程序的reg值) [英] Windows CE 6.0 signalStart (reg values to init chosen application)

查看:64
本文介绍了Windows CE 6.0 signalStart(初始选择应用程序的reg值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我一直在使用我之前在MSDN网站上找到的许多配置,以及我在哪里可以找到有关Windows CE 6.0的信息。


基本上现在我正在尝试使用平台构建器运行作为VS 2005模板的hello_world应用程序。我已经构建了运行时映像,它正确地引导到我的设备。然而问题是我正在构建一个自定义设备,我需要设备
直接启动到我的应用程序,而不会看到桌面。


根据大多数教程,我发现我已经在注册表中创建了launchXX和dependXX(以前尝试过launch50和depend50来替换explorer.exe从启动中),从那以后它一直保持在launch51和依赖51只是
试图查看是否否则它将起作用。


由于某些帐户验证错误,我暂不允许发布图片。但是,launch51设置为hello_world.exe,depend51设置为14 00 1e 00 32 00(使用GUI界面添加值)



现在我没有修改代码中的任何内容,除了添加startSignal函数并包含我在MSDN文章中描述的内容。我在下面列出了代码块。


我无法弄清楚我的可执行文件的路径是不正确的?目前它只是坐在我的rel目录中。我找到了关于如何直接列出应用程序的整个文件路径的混合注释,其中没有一个似乎有帮助。是否有更好的
文章解释了这个,如果是这样我还没有看到它。


我是否调用了signalStart函数并传递了错误的参数?我的想法是我应该传递启动值,在这种情况下是51或0x33。这是一个正确的假设吗?


还有其他方法可以通过硬编码现有文件来启动我的应用程序吗?我会继续看......但我希望有人能够指出我可能错过的一些资源。我提前感谢任何帮助。这似乎是一个简单的任务,但这是第一次我在Windows上尝试过这样的东西,我觉得我只是忽略了一些简单的事情,以前曾经通过它的人能够快速而轻松地指出。



hello_world.h:

 #if!defined(AFX_HELLO_WORLD_H__F356CAE1_EC57_4A59_A1C3_39674F3966BE__INCLUDED_)
#define AFX_HELLO_WORLD_H__F356CAE1_EC57_4A59_A1C3_39674F3966BE__INCLUDED_

#if _MSC_VER> 1000
#pragma一次
#endif // _MSC_VER> 1000

#include" resource.h"
#include" winbase.h" //为signalStart添加
#include" coredll.lib" //为signalStart添加


#endif // !定义(AFX_HELLO_WORLD_H__F356CAE1_EC57_4A59_A1C3_39674F3966BE__INCLUDED_)

hello_world.cpp:

 // hello_world.cpp:定义申请的入口点。 
//

#include" stdafx.h"
#include" resource.h"


#define MAX_LOADSTRING 100

//全局变量:
HINSTANCE hInst; //当前实例
TCHAR szTitle [MAX_LOADSTRING]; //标题栏文本
TCHAR szWindowClass [MAX_LOADSTRING]; //标题栏文本

//此代码模块中包含的函数的前向声明:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE,int);
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);

int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
SignalStarted(0x33); //信号启动
// TODO:在这里放置代码。
MSG msg;
HACCEL hAccelTable;

//初始化全局字符串
LoadString(hInstance,IDS_APP_TITLE,szTitle,MAX_LOADSTRING);
LoadString(hInstance,IDC_hello_world,szWindowClass,MAX_LOADSTRING);
MyRegisterClass(hInstance);

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

hAccelTable = LoadAccelerators(hInstance,(LPCTSTR)IDC_hello_world);

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

返回msg.wParam;
}



//
//功能:MyRegisterClass()
//
//目的:注册窗口类。
//
//评论:
//
//只有当你想让这个代码
//与Win32兼容时,才需要这个函数及其用法添加到Windows 95的'RegisterClassEx'
//函数之前的系统。调用此函数
//非常重要,这样应用程序将获得"格式良好"的小图标关联
//用它。
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASS wc;

wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc =(WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = szWindowClass;

返回RegisterClass(& wc);
}

//
//功能:InitInstance(HANDLE,int)
//
//目的:保存实例句柄并创建主窗口
//
// COMMENTS:
//
//在这个函数中,我们将实例句柄保存在一个全局变量中,
//创建并显示主程序窗口。
//
BOOL InitInstance(HINSTANCE hInstance,int nCmdShow)
{
HWND hWnd;

hInst = hInstance; //在我们的全局变量中存储实例句柄

hWnd = CreateWindow(szWindowClass,szTitle,WS_VISIBLE,
0,0,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);

if(!hWnd)
{
返回FALSE;
}

ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);

返回TRUE;
}

//
//功能:WndProc(HWND,无符号,WORD,LONG)
//
//目的:处理消息主窗口。
//
// WM_COMMAND - 处理应用程序菜单
// WM_PAINT - 绘制主窗口
// WM_DESTROY - 发布退出消息并返回
//
//
LRESULT CALLBACK WndProc(HWND hWnd,UINT消息,WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
TCHAR szHello [MAX_LOADSTRING];
LoadString(hInst,IDS_HELLO,szHello,MAX_LOADSTRING);

switch(message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd,& ps);
// TODO:在这里添加任何绘图代码...
RECT rt;
GetClientRect(hWnd,& rt);
DrawText(hdc,szHello,_tcslen(szHello),& rt,DT_CENTER);
EndPaint(hWnd,& ps);
休息;
案例WM_DESTROY:
PostQuitMessage(0);
休息;
默认值:
返回DefWindowProc(hWnd,message,wParam,lParam);
}
返回0;
}



解决方案

我已经为我们用于产品和产品测试的各种图像做了这个效果很好。 


我们选择克隆TaskManager,隐藏工具栏并让它显示为黑色的空寡妇。 这可以防止桌面在启动时显示并允许键盘输入(即ctrl-alt-del)。


通常你包括* .dll& * .exe在您的映像中,它们会在启动时复制到\ windows文件夹,然后由" Launch50" =" MyApp.exe"启动。 请注意,有各种* .reg文件中的启动条目
- 查看发布文件夹中的reginit.ini文件,了解图像中实际使用的条目。


如果您有要从中启动应用程序的永久性媒体,只需将应用程序复制到特定媒体(即USB媒体的"\ USB驱动器")并将媒体文件夹添加到启动条目中的应用程序名称("Launch50"= \\USB
Drive \\ MyApp.exe
)。   


Bill


<一> <一个> <一> <一个> <一> <一个>

Ok, I have been playing around with a lot of configurations that I had previously found on the MSDN website and also where ever I could find information on Windows CE 6.0.

Basically right now I am trying to run the hello_world app that is a template on VS 2005 using platform builder. I have built the runtime image and it boots to my device correctly. However the issue is that I am building a custom device and I need to device to boot to my application directly without ever seeing the desktop.

As per most of the tutorials that I have found I have created the launchXX and dependXX in the registry (previously tried launch50 and depend50 to replace the explorer.exe from launching), and since then have kept it on launch51 and depend51 just trying to see if it will work otherwise.

This would not allow me to post an image just yet due to some account verification error. However the launch51 is set to hello_world.exe and the depend51 is set to 14 00 1e 00 32 00 (using the GUI interface to add the values)

Now I have not modified anything within the code besides adding the startSignal function and includes that is described in the MSDN articles that I have found. I included the code blocks below.

What I cannot figure out is my path for the executable incorrect? Currently it is just sitting in my rel directory. I have found mixed notes on how to directly list the entire file path for the application, none of which seemed to help. Is there a better article that explains this, if so I have not seen it yet.

Am I calling the signalStart function and passing the wrong parameter? My thought was that I should be passing the launch value, in this case is 51 or 0x33. Is that a correct assumption?

Is there some other way that I can start my application by hard coding an existing file? I will continue to look... but I was hoping someone might be able to point me to some resources that I may have missed. I appreciate any help in advance. It seemed like it would have been an easy task, but this is the first time I have tried anything like this on windows and I feel like I am just overlooking something simple that someone who has worked through it before would be able to point out quickly and with little effort.

hello_world.h:

#if !defined(AFX_HELLO_WORLD_H__F356CAE1_EC57_4A59_A1C3_39674F3966BE__INCLUDED_)
#define AFX_HELLO_WORLD_H__F356CAE1_EC57_4A59_A1C3_39674F3966BE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "resource.h"
#include "winbase.h"//Added for signalStart
#include "coredll.lib"//Added for signalStart


#endif // !defined(AFX_HELLO_WORLD_H__F356CAE1_EC57_4A59_A1C3_39674F3966BE__INCLUDED_)

hello_world.cpp:

// hello_world.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "resource.h"


#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;                      // current instance
TCHAR szTitle[MAX_LOADSTRING];        // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];  // The title bar text

// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR     lpCmdLine,
                     int       nCmdShow)
{
	SignalStarted(0x33);//signal started
    // TODO: Place code here.
    MSG msg;
    HACCEL hAccelTable;

    // Initialize global strings
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadString(hInstance, IDC_hello_world, szWindowClass, MAX_LOADSTRING);
    MyRegisterClass(hInstance);

    // Perform application initialization:
    if (!InitInstance (hInstance, nCmdShow)) 
    {
        return FALSE;
    }

    hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_hello_world);

    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0)) 
    {
        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return msg.wParam;
}



//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
//  COMMENTS:
//
//    This function and its usage is only necessary if you want this code
//    to be compatible with Win32 systems prior to the 'RegisterClassEx'
//    function that was added to Windows 95. It is important to call this function
//    so that the application will get 'well formed' small icons associated
//    with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
    WNDCLASS wc;

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = (WNDPROC) WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = 0;
    wc.hCursor = 0;
    wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = 0;
    wc.lpszClassName = szWindowClass;

    return RegisterClass(&wc);
}

//
//   FUNCTION: InitInstance(HANDLE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
      0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND  - process the application menu
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT ps;
    HDC hdc;
    TCHAR szHello[MAX_LOADSTRING];
    LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);

    switch (message) 
    {
        case WM_PAINT:
            hdc = BeginPaint(hWnd, &ps);
            // TODO: Add any drawing code here...
            RECT rt;
            GetClientRect(hWnd, &rt);
            DrawText(hdc, szHello, _tcslen(szHello), &rt, DT_CENTER);
            EndPaint(hWnd, &ps);
            break;
        case WM_DESTROY:
            PostQuitMessage(0);
            break;
        default:
            return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}

解决方案

I have done this for various images that we use for our products and product testing and it works quite well. 

We chose to clone TaskManager, hide the tool bar and have it appear as a black, empty widow.  This prevents the desktop from being displayed at boot and allows keyboard input (ie. ctrl-alt-del).

Normally you include your *.dll & *.exe's in your image, they get copied to the \windows folder at boot and get launched by "Launch50"="MyApp.exe".  Note there are Launch entries in various *.reg files - view the reginit.ini file in your release folder for the entries actually used in the image.

If you have persistent media that you would like to launch your app from, simply copy the app to the specific media (ie "\USB Drive" for USB media) and prepended the media folder to the app name in launch entry ("Launch50"=\\USB Drive\\MyApp.exe).   

Bill


这篇关于Windows CE 6.0 signalStart(初始选择应用程序的reg值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆