用文本编辑器打开自己分析一下。
比较好的编辑器可以用pctools类,
金山和华军上都有

解决方案 »

  1.   

    IShellLink::Resolve
    IShellLink::GetIconLocation
    IShellLink::GetPath
    IShellLink::GetWorkingDirectory下面是 VC 代码(我不会 DELPHI,我想转换过去应当容易):
    BOOL CLinkTestDlg::ResolveLink(HWND hwnd, LPCTSTR lpszLinkFile, LPTSTR lpszPath)
    {
    USES_CONVERSION;
        HRESULT hr; 
        IShellLink *psl; 
        TCHAR szGotPath[MAX_PATH]; 
        TCHAR szDescription[MAX_PATH]; 
        WIN32_FIND_DATA wfd;     *lpszPath = 0; // assume failure     // Get a pointer to the IShellLink interface. 
        hr = CoCreateInstance(CLSID_ShellLink, NULL, 
            CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *) &psl); 
        if (SUCCEEDED(hr)) 

            IPersistFile *ppf;         // Get a pointer to the IPersistFile interface. 
            hr = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); 
            if (SUCCEEDED(hr)) 

                LPWSTR lpw;            // Ensure that the string is Unicode. 
    lpw = T2W(lpszLinkFile);            // Load the shortcut. 
                hr = ppf->Load(lpw, STGM_READ); 
                if (SUCCEEDED(hr)) 

                    // Resolve the link. 
                    hr = psl->Resolve(hwnd, SLR_NO_UI); 
                    if (SUCCEEDED(hr)) 

                        // Get the path to the link target. 
                        hr = psl->GetPath(szGotPath, 
                            MAX_PATH, (WIN32_FIND_DATA *)&wfd, 
                            SLGP_SHORTPATH ); 
                        if (FAILED(hr))
                            ;                    // Get the description of the target. 
                        hr = psl->GetDescription(szDescription, MAX_PATH); 
                        if (FAILED(hr)) 
                            ;
                        lstrcpy(lpszPath, szGotPath); 
                    } 
                } 
            // Release the pointer to the IPersistFile interface. 
            ppf->Release(); 
            } 
        // Release the pointer to the IShellLink interface. 
        psl->Release(); 
        } 
        return hr; 

      

  2.   

    我的主要问题是不知道如何从.lnk中取图标(特别是“无图标程序”的快捷方式)。
    另外,用ExtractIcon提取图标时发现,
    有时虽然取到HICON,但用Image.picture.assign(HICON)不一定能显示出来,可能跟ICON的属性有关,能否指点一下。