关于双击文件打开的问题

山顶洞人-平 2003-01-10 07:47:51
请问如何实现双击文件图标,用自己的程序打开?双击文件图标后,文件路径是否保存在注册表某处?如何编程实现?
...全文
50 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingofvc 2003-01-11
  • 打赏
  • 举报
回复
技术内幕里面都讲的很清楚 你可以去看看这本书
我把里面的两幅图截了出来你可以先看看
http://kingeyes.51.net/b.jpg
http://kingeyes.51.net/a.jpg
akiy 2003-01-11
  • 打赏
  • 举报
回复
如果是基于文档的
可以在appwizard的第四步(如果没记错的话)advanced中修改支持文件的扩展名
然后再如上面仁兄说的加上
在app类中调用下面的函数RegisterShellFileTypes
CWinApp::RegisterShellFileTypes
void RegisterShellFileTypes( BOOL bCompat = FALSE );

山顶洞人-平 2003-01-10
  • 打赏
  • 举报
回复
具体应该怎么做,请各位详细解答,谢谢。
fhqiplj 2003-01-10
  • 打赏
  • 举报
回复
那个图标仅仅是一个快捷方式,系统可以得到指向的路径名和命令,然后就可以打开文件了
Pipi0714 2003-01-10
  • 打赏
  • 举报
回复
gz
kingofvc 2003-01-10
  • 打赏
  • 举报
回复
在app类中调用下面的函数RegisterShellFileTypes
CWinApp::RegisterShellFileTypes
void RegisterShellFileTypes( BOOL bCompat = FALSE );

Parameters

bCompat

TRUE adds registration entries for shell commands Print and Print To, allowing a user to print files directly from the shell, or by dragging the file to a printer object. It also adds a DefaultIcon key. By default, this parameter is FALSE for backward compatibility.

Remarks

Call this member function to register all of your application’s document types with the Windows File Manager. This allows the user to open a data file created by your application by double-clicking it from within File Manager. Call RegisterShellFileTypes after you call AddDocTemplate for each of the document templates in your application. Also call the EnableShellOpen member function when you call RegisterShellFileTypes.

RegisterShellFileTypes iterates through the list of CDocTemplate objects that the application maintains and, for each document template, adds entries to the registration database that Windows maintains for file associations. File Manager uses these entries to open a data file when the user double-clicks it. This eliminates the need to ship a .REG file with your application.

If the registration database already associates a given filename extension with another file type, no new association is created. See the CDocTemplate class for the format of strings necessary to register this information.

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧