同上。。或者写这个一个Solid.reg文件。REGEDIT ; This .REG file may be used by your SETUP program. ; If a SETUP program is not available, the entries below will be ; registered in your InitInstance automatically with a call to ; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.HKEY_CLASSES_ROOT\.sgf = Solid.Document HKEY_CLASSES_ROOT\Solid.Document\shell\open\command = SOLID.EXE %1 HKEY_CLASSES_ROOT\Solid.Document\shell\open\ddeexec = [open("%1")] HKEY_CLASSES_ROOT\Solid.Document\shell\open\ddeexec\application = SOLID ; note: the application is optional ; (it defaults to the app name in "command")HKEY_CLASSES_ROOT\Solid.Document = Solid Document注:我生成的工程是Solid,所以你自己改改中间的数据和文件名,然后放在你的工程下也许能行。 反正你也可以用这个文件中的注册位置自己改。
若MFC向导设置里忘了,可以通过改代码来实现
在InitInstance里添加以下代码 // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE);
在以下位置,以txt为例,具体可以查看注册表.
// HKEY_CLASSES_ROOT
// HKEY_CLASSES_ROOT\.TXT
// 默认 = TXTfile
// HKEY_CLASSES_ROOT\TXTfile
// 默认 = TXT文档
// HKEY_CLASSES_ROOT\TXTfile\DefaultIcon
// 默认 = C:\Winnt\Notepad.exe,0
// HKEY_CLASSES_ROOT\TXTfile\shell
// HKEY_CLASSES_ROOT\TXTfile\shell\使用记事本打开
// HKEY_CLASSES_ROOT\TXTfile\shell\使用记事本打开\command
// 默认 = "C:\Winnt\Notepad.exe" "%1"
; This .REG file may be used by your SETUP program.
; If a SETUP program is not available, the entries below will be
; registered in your InitInstance automatically with a call to
; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.HKEY_CLASSES_ROOT\.sgf = Solid.Document
HKEY_CLASSES_ROOT\Solid.Document\shell\open\command = SOLID.EXE %1
HKEY_CLASSES_ROOT\Solid.Document\shell\open\ddeexec = [open("%1")]
HKEY_CLASSES_ROOT\Solid.Document\shell\open\ddeexec\application = SOLID
; note: the application is optional
; (it defaults to the app name in "command")HKEY_CLASSES_ROOT\Solid.Document = Solid Document注:我生成的工程是Solid,所以你自己改改中间的数据和文件名,然后放在你的工程下也许能行。
反正你也可以用这个文件中的注册位置自己改。
m_pMainWnd->DragAcceptFiles(); // Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(TRUE);
标题\n\n你的扩展名\n\n\n你的扩展名.Document\n文档描述
m_pMainWnd->DragAcceptFiles(); // Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(TRUE);
==========================================
这也没指定扩展名啊