• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 獲取快捷方式的目標和參數

    發表于:2007-07-14來源:作者:點擊數: 標簽:
    我看了Michael Taupitz關于建立快捷方式的方法,我認為有很多時候當我 們在命令行模式中偶然發現一個快捷方式的時候,我們不知道這個.lnk文件指 向什么地方。 我寫了一個函數,它以CString的形式返回了.lnk文件的目標和參數。 CString GetShortcutTarget(con
        我看了Michael Taupitz關于建立快捷方式的方法,我認為有很多時候當我
    們在命令行模式中偶然發現一個快捷方式的時候,我們不知道這個.lnk文件指
    向什么地方。

    我寫了一個函數,它以CString的形式返回了.lnk文件的目標和參數。

    CString GetShortcutTarget(const CString LinkFileName)
    {
    HRESULT hres;

    CString Link, Temp = LinkFileName;
    Temp.MakeLower();
    if (Temp.Find(".lnk")==-1)           //Check if the name ends with .lnk
    Link = LinkFileName + ".lnk";   //if not, append it
    else
    Link = LinkFileName;

    CString Info;
    Info.Empty();

    IShellLink* psl;

    //Create the ShellLink object
    hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
    IID_IShellLink, (LPVOID*) &psl);

    if (SUCCEEDED(hres))
    {
    IPersistFile* ppf;
    //Bind the ShellLink object to the Persistent File
    hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf);
    if (SUCCEEDED(hres))
    {
    WORD wsz[MAX_PATH];
    //Get a UNICODE wide string wsz from the Link path
    MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, Link, -1, wsz,      MAX_PATH);

    //Read the link into the persistent file
    hres = ppf->Load(wsz, 0);

    if (SUCCEEDED(hres))
    {
    //Read the target information from the link object
    //UNC paths are supported (SLGP_UNCPRIORITY)
    psl->GetPath(Temp.GetBuffer(1024), 1024, NULL,               SLGP_UNCPRIORITY);
    Temp.ReleaseBuffer();
    Info = Temp;

    //Read the arguments from the link object
    psl->GetArguments(Temp.GetBuffer(1024), 1024);
    Temp.ReleaseBuffer();
    Info += " " + Temp;
    }
    }
    }
    psl->Release();
    //Return the Target and the Argument as a CString
    return Info;
    }

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>