为什么简单的控制台应用程序运行,但基于对话框不运行在WIN CE 6.0? [英] Why simple console app runs but dialog based does not run in WIN CE 6.0?

查看:253
本文介绍了为什么简单的控制台应用程序运行,但基于对话框不运行在WIN CE 6.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发嵌入式Visual C ++ 4中的Windows CE 6.0应用程序。

I am developing an application for Windows CE 6.0 in embedded Visual C++ 4.

我用平台Pocket PC 2003创建了一个简单的控制台应用程序用以下简单代码:

I created a simple console application (WCE Application) with platform "Pocket PC 2003" with the following simple code:

#include "stdafx.h"
#include <stdio.h>

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

    FILE * pFile; 
    char c; 
    pFile=fopen("alphabet.txt","wt");   
    for (c = 'A' ; c <= 'Z' ; c++) {
        putc (c , pFile);
    }   
    fclose (pFile); 
    return 0;
}

这个简单的代码在我的WinCE 6.0设备和alphabet.txt

This simple code works correctly on my WinCE 6.0 device and "alphabet.txt" is created.

但是当我创建一个基于对话框的项目(WCE MFC AppWizard(exe))并把这个代码在我的项目的主类中,在我的对话框初始化之前窗口它不工作,没有alphabet.txt文件被创建,我的应用程序不打开没有任何消息。

But when I create a dialog based project (WCE MFC AppWizard(exe)) and put this code in main class of my project before the initialization of my dialog window it does not work and no "alphabet.txt" file is created and my app does not open without any messages.

BOOL CFffffApp::InitInstance()
{
    // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.


    FILE * pFile; 
    char c; 
    pFile=fopen("alphabet.txt","wt");   
    for (c = 'A' ; c <= 'Z' ; c++) {
        putc (c , pFile);
    }   
    fclose (pFile); 


    CFffffDlg dlg;
    m_pMainWnd = &dlg;
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
        // TODO: Place code here to handle when the dialog is
        //  dismissed with OK
    }
    else if (nResponse == IDCANCEL)
    {
        // TODO: Place code here to handle when the dialog is
        //  dismissed with Cancel
    }

    // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.
    return FALSE;
}

为什么它不工作,如何解决这个问题?

Why it does not work and how can I resolve this problem?

提前感谢,

推荐答案

目标设备是否具有MFC运行时它?它们也必须是您的应用程序所构建的。请注意,eVC 4.0使用了mfcce400.dll,它没有随Platform Builder 6.0提供(实际上IIRC MFC甚至不在CE 6.0操作系统目录中,Studio '08为设备使用了更新的MFC版本)。您必须与您的应用程序一起分发mfcce400二进制文件(它们在eVC SDK中)。

Does the target device have the MFC runtimes on it? They also have to be the ones your app is built for. Be aware that eVC 4.0 used mfcce400.dll, which did not ship with Platform Builder 6.0 at all (in fact IIRC MFC isn't even in the CE 6.0 OS catalog and Studio '08 used a newer MFC version for devices). You'll have to distribute the mfcce400 binaries (they're in the eVC SDKs) along with your app.

这篇关于为什么简单的控制台应用程序运行,但基于对话框不运行在WIN CE 6.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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