IWebBrowser2::ExecWB(OLECMDID_SAVE,OLECMDEXECOPT_PROMPTUSER,NULL,NULL);

解决方案 »

  1.   

    能完整些吗?谢谢!
    还有用OFN_EXPLORER | OFN_ENABLEHOOK来做的有人知道吗?
      

  2.   

    //************************************************************************
    // Function:  GetFileName (HWND, LPSTR, LPDWORD)
    //
    //   Purpose:  Prompts user for a filename through the use of a Windows 3.1
    //             FileOpen common dialog box.
    //
    //   Parameters:  HWND hWndOwner      Owner who is calling this funciton
    //
    //             LPSTR szFileName    Buffer where selected filename will
    //                                 be placed.  Must be at least _MAX_PATH
    //                                 characters large
    //
    //   Returns:  TRUE if a filename is selected.
    //             FALSE if no filename is selected.
    //
    //  Comments:  Filename is put into the string passed to the routine.
    //             If a filename is not selected, NULL is returned.
    //
    //************************************************************************/
    BOOL SelectDir (HWND hWndOwner, LPSTR szDirName)
    {
        OPENFILENAME   of;
        DWORD          flags;
        static char    szTitle[50] = "选择目录";
        char           szFile[_MAX_PATH];
        static char*   szFilterFile = "位图 (*.bmp)\0*.bmp\0\0";
    static char*   szDefExt = "bmp";
    static char*   szTemplateName = "SELDIR";
        DWORD          dw = 0;               // Local copy of flags for validation
        BOOL           bReturn;             // Return code
        DWORD          dwLocalOpt = 0;    // Initialize the OPENFILENAME members
        flags = OFN_ENABLEHOOK | OFN_ENABLETEMPLATE | OFN_HIDEREADONLY |OFN_OVERWRITEPROMPT;
        lstrcpy(szFile, "1.bmp");    of.lStructSize       = sizeof (OPENFILENAME);
        of.hwndOwner         = hWndOwner;
        of.hInstance         = AfxGetApp()->m_hInstance;
        of.lpstrFilter       = szFilterFile;
        of.lpstrCustomFilter = NULL;
        of.nMaxCustFilter    = 0L;
        of.nFilterIndex      = 1L;
        of.lpstrFile         = szFile;
        of.nMaxFile          = _MAX_PATH;
        of.lpstrFileTitle    = NULL;
        of.nMaxFileTitle     = 0;
        of.lpstrInitialDir   = szDirName;
        of.lpstrTitle        = szTitle;
        of.Flags             = flags;
        of.nFileOffset       = 0;
        of.nFileExtension    = 0;
        of.lpstrDefExt       = szDefExt;
        of.lpfnHook          = (LPOFNHOOKPROC)FileOpenHookProc;
        of.lpTemplateName    = szTemplateName;    // Place our flags in the lCustData parameter    of.lCustData         = dwLocalOpt;    // Call the GetSaveFilename function    if (GetOpenFileName (&of))
        {
            bReturn = TRUE;
    GetDir(of.lpstrFile, szDirName);
        }
        else
        {
    bReturn = FALSE;
            szDirName[0] = '\0';
        }    return bReturn;
    }
    /*************************************************************************  Function:  FileOpenHookProc (HWND, WORD, WORD, LONG)   Purpose:  Hook procedure for FileSave common dialog box.   Returns:  TRUE if message was processed.
                 FALSE if the system needs to process the message.  Comments:*************************************************************************/BOOL APIENTRY FileOpenHookProc (HWND hDlg, WORD msg, DWORD wParam, LONG lParam)
    {
        return FALSE;
    }
      

  3.   

    不行,还缺点什么吧,大概是那个OFN_ENABLETEMPLATE 有关的。
    谢谢指点!
      

  4.   

    OFN_ENABLETEMPLATE :使用自定义的对话框模板,不自定义的话就去掉。