2000里面所有的快速启动工具栏的快捷方式均对应
C:\Documents and Settings\administrator\Application Data\Microsoft\Internet Explorer\Quick Launch
下面的一个快捷方式的文件,在它里面建快捷方式就行了

解决方案 »

  1.   


        谢谢,不过这个我也知道。如果你知道怎么做的话,给我发个demo好吗?不要只说不练,呵呵,莫耍嘴呀。另外,快捷方式的文件好像有很多类型,不知道谁能详细解释一下。
      

  2.   

    andygood兄你好,这几句话小弟可听着不怎么习惯呢,呵呵呵,小弟虽然常被人笑过,但被人怀疑过的次数终究还没到习惯的程度,这个demo我确实以前没做过,当如果这次不动一下的话,倒也真是仅仅贫嘴而已了!
    下面这两段代码是直接从资料摘下来,不知道andygoo会不会怪小弟不是自己动手写的呢!^_^如果要在桌面上建立记事本的快捷方式,运行时就打开config.sys文件: 
    CreateShortcut("c:\\windows\\notepad.exe","c:\\config.sys","c:\\windows"/*程序起始位置*/,
    "c:\\windows\\desktop\\记事本.lnk","记事本"); HRESULT CreateShortcut(LPCSTR pszPathObj,LPSTR pszParam,LPSTR pszPath,LPSTR pszPathLink,LPSTR pszDesc) 

        HRESULT hres ; 
        IShellLink * psl ; 
        IPersistFile* ppf ; 
        WORD wsz[ MAX_PATH] ;     CoInitialize(NULL); 
        hres = (HRESULT)CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, &psl) ; 
        if( FAILED( hres)) 
         { 
            CoUninitialize(); 
             return FALSE ; 
        } 
        // set the path to the shortcut target, and add the description 
         psl -> lpVtbl -> SetPath( psl, pszPathObj) ; 
        psl -> lpVtbl -> SetArguments( psl, pszParam) ; 
        psl -> lpVtbl -> SetDescription( psl, pszDesc); 
        psl -> lpVtbl -> SetWorkingDirectory(psl,pszPath);      // query IShellLink for the IPersistFile interface for saving the shortcut in persistent storage 
        hres = (HRESULT)(psl -> lpVtbl -> QueryInterface( psl, &IID_IPersistFile, &ppf)) ; 
        if( FAILED( hres)) 
        { 
            CoUninitialize(); 
            return FALSE ; 
        }     // ensure that that string is ANSI 
        MultiByteToWideChar( CP_ACP, 0, pszPathLink, -1, wsz, MAX_PATH) ;     // save the link by calling IPersistFile::Save 
        hres = ppf -> lpVtbl -> Save( ppf, wsz, STGM_READWRITE) ;     // release the IPersistFile interface 
        ppf -> lpVtbl -> Release( ppf) ; 
        // release the IShellLink interface 
        psl -> lpVtbl -> Release( psl) ;     CoUninitialize();     return hres ; 
    }  第二使用类似如下程序段 dlg.SetStatus("正在建立程序组和快捷方式..."); 
    char m_strWinDir[512]; 
    long rval; 
    HKEY hKey; 
    DWORD dwType;  
    char szText[80]; 
    DWORD dwSize, dwDisp; 
    rval = RegOpenKeyEx(HKEY_CURRENT_USER, 
            "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", 
            NULL, KEY_QUERY_VALUE, &hKey); 
     
    if(rval == ERROR_SUCCESS) 

            dwSize = 512; 
            rval = RegQueryValueEx(hKey, "Programs", 0, 
                    &dwType, (LPBYTE)m_strWinDir, &dwSize); 
            rval = RegCloseKey(hKey); 
            strcat(m_strWinDir, "\\惠普KeyIn系统"); 
            CreateDirectory(m_strWinDir, NULL); 
            strcat(m_strWinDir, "\\惠普KeyIn系统.lnk"); 
            HRESULT hres;  
            IShellLink* psl;  
            // Get a pointer to the IShellLink interface.  
            CoInitialize(NULL); 
            hres = CoCreateInstance(CLSID_ShellLink, NULL,  
                    CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *)&psl);  
            if(SUCCEEDED(hres)) 
            {  
                    IPersistFile* ppf;  
                    // Set the path to the shortcut target, and add the  
                    // description.  
                    if(!pSheet->bUseNetwork) 
                    { 
                            psl->SetPath("c:\\keyin\\keyin.exe");  
                            psl->SetWorkingDirectory("c:\\keyin"); 
                    } 
                    else 
                    { 
                            CString temp; 
                            temp = pSheet->m_strPath.Left(pSheet->m_strPath.GetLength()-10); 
                            if(temp.GetLength() == 2)temp += "\\"; 
                            psl->SetPath(pSheet->m_strPath);  
                            psl->SetWorkingDirectory(temp); 
                    } 
                    psl->SetDescription("惠普KeyIn系统");  
               // Query IShellLink for the IPersistFile interface for saving the  
               // shortcut in persistent storage.  
                    hres = psl->QueryInterface(IID_IPersistFile,  
                            (LPVOID *)&ppf);  
                    if(SUCCEEDED(hres)) 
                    {  
                            WORD wsz[MAX_PATH];  
                            // Ensure that the string is ANSI.  
                            MultiByteToWideChar(CP_ACP, 0, m_strWinDir, -1,  
                                    wsz, MAX_PATH);  
                            // Save the link by calling IPersistFile::Save.  
                            hres = ppf->Save(wsz, TRUE);  
                            ppf->Release();  
                    }  
                    psl->Release();  
            } 

    else 

            MessageBox("创建程序组和快捷方式失败,请稍后自行创建。", "错误"); 

      

  3.   


        呵呵,我的激将法总是有效。不过我可丝毫没有怀疑别人呀!!!    谢谢你的回答,我试了一下,第一个函数有错,不过我已经改正了。如下:HRESULT CreateShortcut( LPCSTR pszPathObj,
                            LPSTR pszParam,
                            LPSTR pszPath,                LPSTR pszPathLink,
                            LPSTR pszDesc) 

        HRESULT hres ; 
        IShellLink * psl ; 
        IPersistFile* ppf ; 
        WORD wsz[ MAX_PATH] ;     CoInitialize(NULL); 
        hres = (HRESULT)CoCreateInstance( CLSID_ShellLink, 
                                          NULL, 
                                          CLSCTX_INPROC_SERVER, 
                                          IID_IShellLink, 
                                          (LPVOID*) &psl);
        if( FAILED( hres)) 
        {
            CoUninitialize(); 
             return FALSE ; 
        }
        // set the path to the shortcut target, and add the description 
        psl -> SetPath( pszPathObj) ; 
        psl -> SetArguments( pszParam) ; 
        psl -> SetDescription( pszDesc); 
        psl -> SetWorkingDirectory( pszPath );      // query IShellLink for the IPersistFile interface for saving the shortcut in persistent storage 
        hres = (HRESULT)(psl -> QueryInterface( IID_IPersistFile, (void **) &ppf)) ; 
        if( FAILED( hres)) 
        { 
            CoUninitialize(); 
            return FALSE ; 
        }    // ensure that that string is ANSI 
        MultiByteToWideChar( CP_ACP, 0, pszPathLink, -1, wsz, MAX_PATH) ;     // save the link by calling IPersistFile::Save 
        hres = ppf -> Save( wsz, STGM_READWRITE) ;     // release the IPersistFile interface 
        ppf -> Release( ) ; 
        // release the IShellLink interface 
        psl -> Release( ) ;     CoUninitialize();     return hres ; 
    }      以下的代码将在我的win2000中创建一个快捷方式(注:我装了98和2000,其中C:为98,D:为2000):    CreateShortcut( _T("c:\\windows\\notepad.exe"),
                        NULL, NULL,
                        _T("D:\\Documents and Settings\\Administrator\\Application Data\\Microsoft\\Internet Explorer\\Quick Launch\\Notepad.lnk"),
                        NULL );      但愿以上代码对有类似问题的网友有帮助。思想共享,代码共享!