Why simple console app runs but dialog based does not run in WIN CE 6.0?(为什么简单的控制台应用程序运行,但基于对话框的不在 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.
我使用以下简单代码创建了一个简单的控制台应用程序(WCE 应用程序),平台为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 中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么简单的控制台应用程序运行,但基于对话框的不在 WIN CE 6.0 中运行?
基础教程推荐
- 使用从字符串中提取的参数调用函数 2022-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 从 std::cin 读取密码 2021-01-01