向导生成的MFC文件/打开/保存/另存为/关闭 [英] MFC File/Open/Save/SaveAs/Close generated by Wizard

查看:94
本文介绍了向导生成的MFC文件/打开/保存/另存为/关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人会解释如何在不单击菜单中的文件->打开"的情况下打开存储在我的硬盘上的数据文件吗?我可以通过调用CFile类来打开此文件,但它的功能与菜单打开命令不同.我想念的幕后发生了什么?如果我通过单击文件"->打开"并选择我的数据文件来打开此文件,它将按我的意愿填充表单.但是,如果我从代码中打开该文件,除了打开文件进行读取/写入外,它什么也不会做.

我已经欠了阿尔伯特·H差不多一百万美元,但是如果有人乐于解释这个问题,我几乎会给你一百万美元! =)

Will someone explain how to open my data file that is stored on my hard drive without clicking "File->Open" from the menu? I can open this file by calling the CFile class, but it doesn''t act the same as the menu open command. What''s happening behind the scenes that I''m missing? If I open this file by clicking on File->Open and selecting my data file, it populates my form like I want. But, if I open this file from code, it doesn''t do anything but open the file for reading/writing.

I already owe Albert H almost a million bucks, but if someone would be so kind to explain this, I would almost give you a million bucks! =)

推荐答案

您需要调用Windows API CreateProcess,并使用完整的文件名而不是应用程序的名称.如果文件扩展名通过注册表通过Shell与某些应用程序相关联,则该应用程序将被称为注册方式.

请参阅 http://msdn.microsoft.com/en-us/library/ms682425(v = vs.85).aspx [
You need to call Windows API CreateProcess and use your full file name instead the name of the application. If the file extension is associated with some application with the Shell via the Registry, the application will be called the way it is registered.

See http://msdn.microsoft.com/en-us/library/ms682425(v=vs.85).aspx[^].

—SA


这篇关于向导生成的MFC文件/打开/保存/另存为/关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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