1.HKEY_Class_Root/.ABC 写入 (默认)串值(REG_SZ)为 "ABCfile ";
2.HKEY_Class_Root/ABCfile/Shell/Open/Command写入,(默认)串值为 "abc.exe %1 "。
HKEY hkey;
RegCreateKey(HKEY_CLASSES_ROOT,L"Software//文仔//admin",&hkey);
RegSetValue(hkey,NULL,REG_SZ,L"文仔",strlen("文仔"));
RegCloseKey(hkey);
3.BOOL CMyApp::InitInstance()
{
// ...
if (m_lpCmdLine[0] == '/0')
{
// 创建一个新(空的)文档
OnFileNew();
}
else
{
// 打开作为第一个命令行参数传递的文件
OpenDocumentFile(m_lpCmdLine);
}
// ...
}
m_lpCmdLine 得到双击文件的全路径文件名。