这个问题困扰很久,我要一段源代码。
可以实现jscript的打开特定风格ie窗口的功能。
高分相送,要多少有多少。

解决方案 »

  1.   

    CFile f;
    CString str;
    CString str2="我要打开的网页.htm";
    f.open("a.htm",CFile::modeWrite|CFile::modeCreate);
    str="<script language=javascript>open(\""+str2+"\")</script>";
    f.write(str,str.GetLength());
    f.close();
    ShellExec(0,"a.htm",0,0,0);
    CFile::Remove("a.htm");
      

  2.   

    error C2039: 'open' : is not a member of 'CFile'
    error C2039: 'write' : is not a member of 'CFile'
    error C2039: 'close' : is not a member of 'CFile'
    error C2065: 'ShellExec' : undeclared identifier
      

  3.   

    kwiner(最爱编程) 的说法是正确的。你吧Open/Write/Close换成第一个字母大写,ShellExecute替换ShellExec。只能说明你连基本的VC都不懂。别老呼吁高手。
      

  4.   

    #include <Urlmon.h>
    #include <tchar.h>
    #pragma comment(lib,"urlmon")
    #include <basetyps.h>
    typedef HRESULT STDAPICALLTYPE SHOWHTMLDIALOGFN(HWND hwndParent,
        IMoniker *pMk,
        VARIANT *pvarArgIn,
        WCHAR *pchOptions,
        VARIANT *pvarArgOut
    ); void CTesthtmldlgDlg::OnOK() 
    {
    // TODO: Add extra validation here
    HMODULE hMSHTML = LoadLibrary(TEXT("MSHTML.DLL"));
    BOOL fSuccess;
    WCHAR szUrl[]=L"http://www.csdn.net";
    IMoniker* pMoniker=NULL;
    WCHAR szOptions[]=L"dialogHeight: 179px; dialogWidth: 265px; dialogTop: 99px; dialogLeft: 390px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;";
    VARIANT varReturn;
    VariantInit(&varReturn);
    SHOWHTMLDIALOGFN* pfnShow;
    if(!hMSHTML)
    {
    fSuccess = FALSE;
    goto cleanup;
    }
    pfnShow = (SHOWHTMLDIALOGFN*)GetProcAddress(hMSHTML, TEXT("ShowHTMLDialog"));
    if(!pfnShow)
    {
    fSuccess = FALSE;
    goto cleanup;
    }
    if(FAILED(CreateURLMoniker(NULL, szUrl, &pMoniker)))
    {
    fSuccess = FALSE;
    goto cleanup;
    }
    (pfnShow)(NULL, pMoniker, NULL, szOptions, &varReturn);
    //(pfnShow)(NULL, pMoniker, NULL, NULL, &varReturn);
    //::MessageBox(NULL,"show html dialog","",MB_OK);
    cleanup:
    if(pMoniker)
    pMoniker->Release();
    if(hMSHTML)
    FreeLibrary(hMSHTML);}