我现在有一个用来存储我的应用程序数据的自定义扩展名文件,如何象VC一样通过双击此
文件来启动我的应用程序呢?谢谢

解决方案 »

  1.   

    在注册表里注册你的文件类型和打开的方式,
    如果你是用SDI或MDI开发的话,Visual Studio 6,会自动生成注册信息,
    以SDI为例,在InitInstance()函数中 
    自动添加如下代码
    // Enable DDE Execute open
    EnableShellOpen();
    RegisterShellFileTypes(TRUE);
    //
      

  2.   

    #include "Shellapi.h"HINSTANCE ShellExecute(
        HWND hwnd, 
        LPCTSTR lpOperation,
        LPCTSTR lpFile, 
        LPCTSTR lpParameters, 
        LPCTSTR lpDirectory,
        INT nShowCmd
    );To open a folder, use either of the following calls: ShellExecute(handle, NULL, path_to_folder, NULL, NULL, SW_SHOWNORMAL);or ShellExecute(handle, "open", path_to_folder, NULL, NULL, SW_SHOWNORMAL);To explore a folder, use: ShellExecute(handle, "explore", path_to_folder, NULL, NULL, SW_SHOWNORMAL);To launch the Shell's Find utility for a directory, use:ShellExecute(handle, "find", path_to_folder, NULL, NULL, 0);
    发送邮件:ShellExecute(NULL,NULL,_T( "mailto:[email protected]" ),NULL,NULL,SW_SHOWNORMAL ) ;
    启动程序:ShellExecute(NULL,NULL,_T( "notepad.exe" ),NULL,NULL,SW_SHOWNORMAL ) ;