双击其图标不会启动MFC应用程序! [英] MFC application will not launch by double-clicking its icon!

查看:166
本文介绍了双击其图标不会启动MFC应用程序!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MFC向导在VS2008(VISTA)中创建了一个VC ++项目。 InitInstance()函数包含语句 RegisterShellFileTypes(TRUE)。应用程序正确运行,读取和写入数据文件。但是,



1)当它写入文件时,与文件关联的图标是VS图标而不是应用程序图标!

2)当我双击图标时,屏幕上会打开一个奇怪的二进制文件而不是应用程序!



我也注意到在DEBUG上运行,警告注册数据库更新失败,关键'XXX.Document',其中XXX是应用程序的名称。



是否有MFC错误或我是做错了什么?

I have created a VC++ project in VS2008 (VISTA) using the MFC wizard. The InitInstance() function includes the statement RegisterShellFileTypes(TRUE). The application runs, reads and writes data files correctly. However,

1) When it writes a file, the icon associated with the file is the VS icon and not the application icon!
2) When I double-click on the icon, a strange binary-type file opens up on the screen instead of the application!

I have also noticed that on DEBUG runs, the warning " registration database update failed for key 'XXX.Document' " where XXX is the name of the application.

Is there an MFC bug or am I doing something wrong??

推荐答案

做错了什么。



可能,正在发生的事情是你的应用程序没有足够的权限来编辑注册表,这就是你得到更新失败消息的原因 - 如果它无法编辑注册表,它就无法更改文件关联。 br />


您可能希望将关联设置为安装过程的一部分。

当然,编公羊重置我的协会,而不是询问和记住他们已经问过我的计算机已经不久了!
Doing something wrong.

Probably, what is happening is that your application does not have sufficient privileges to edit the registry, which is why you get the "update fail" message - and if it can't edit the registry, it can't change the file association.

You probably want to set the association once as part of an installation process anyway.
Certainly, programs which reset my associations without both asking and remembering that they have asked allready do not last long on my computer!


这篇关于双击其图标不会启动MFC应用程序!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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