• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            幽幽
             
            posts - 51,  comments - 28,  trackbacks - 0

            Sample Code

            The following code shows how to obtain the filename or path and description of a given link file:

               #include <windows.h>
            #include <shlobj.h>
            // GetLinkInfo() fills the filename and path buffer
            // with relevant information.
            // hWnd         - calling application's window handle.
            //
            // lpszLinkName - name of the link file passed into the function.
            //
            // lpszPath     - the buffer that receives the file's path name.
            //
            // lpszDescription - the buffer that receives the file's
            // description.
            HRESULT
            GetLinkInfo( HWND    hWnd,
            LPCTSTR lpszLinkName,
            LPSTR   lpszPath,
            LPSTR   lpszDescription)
            {
            HRESULT hres;
            IShellLink *pShLink;
            WIN32_FIND_DATA wfd;
            // Initialize the return parameters to null strings.
            *lpszPath = '\0';
            *lpszDescription = '\0';
            // Call CoCreateInstance to obtain the IShellLink
            // Interface pointer. This call fails if
            // CoInitialize is not called, so it is assumed that
            // CoInitialize has been called.
            hres = CoCreateInstance( &CLSID_ShellLink,
            NULL,
            CLSCTX_INPROC_SERVER,
            &IID_IShellLink,
            (LPVOID *)&pShLink );
            if (SUCCEEDED(hres))
            {
            IPersistFile *ppf;
            // The IShellLink Interface supports the IPersistFile
            // interface. Get an interface pointer to it.
            hres = pShLink->lpVtbl->QueryInterface(pShLink,
            &IID_IPersistFile,
            (LPVOID *)&ppf );
            if (SUCCEEDED(hres))
            {
            WORD wsz[MAX_PATH];
            // Convert the given link name string to a wide character string.
            MultiByteToWideChar( CP_ACP, 0,
            lpszLinkName,
            -1, wsz, MAX_PATH );
            // Load the file.
            hres = ppf->lpVtbl->Load(ppf, wsz, STGM_READ );
            if (SUCCEEDED(hres))
            {
            // Resolve the link by calling the Resolve() interface function.
            // This enables us to find the file the link points to even if
            // it has been moved or renamed.
            hres = pShLink->lpVtbl->Resolve(pShLink,  hWnd,
            SLR_ANY_MATCH | SLR_NO_UI);
            if (SUCCEEDED(hres))
            {
            // Get the path of the file the link points to.
            hres = pShLink->lpVtbl->GetPath( pShLink, lpszPath,
            MAX_PATH,
            &wfd,
            SLGP_SHORTPATH );
            // Only get the description if we successfully got the path
            // (We can't return immediately because we need to release ppf &
            //  pShLink.)
            if(SUCCEEDED(hres))
            {
            // Get the description of the link.
            hres = pShLink->lpVtbl->GetDescription(pShLink,
            lpszDescription,
            MAX_PATH );
            }
            }
            }
            ppf->lpVtbl->Release(ppf);
            }
            pShLink->lpVtbl->Release(pShLink);
            }
            return hres;
            }
            

            posted on 2008-08-14 06:02 幽幽 閱讀(586) 評論(0)  編輯 收藏 引用

            <2008年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            常用鏈接

            留言簿(6)

            隨筆分類(35)

            隨筆檔案(51)

            文章分類(3)

            文章檔案(3)

            相冊

            我的鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久亚洲国产精品一区二区| 日本WV一本一道久久香蕉| 久久99国产综合精品女同| 国产精品一久久香蕉产线看 | 久久精品免费网站网| 日韩欧美亚洲综合久久| 国产91色综合久久免费分享| 久久一区二区免费播放| A狠狠久久蜜臀婷色中文网| 亚洲国产成人精品久久久国产成人一区二区三区综 | 一级a性色生活片久久无| 国产精品一区二区久久| 亚洲AV伊人久久青青草原| 久久天天躁狠狠躁夜夜96流白浆 | 久久国产色AV免费观看| 三级片免费观看久久| 久久精品国产亚洲欧美| 一级做a爰片久久毛片看看| 狠狠久久综合伊人不卡| 国产一级持黄大片99久久| 色婷婷综合久久久久中文| 国产精品久久久久久久app| 久久久久一本毛久久久| 亚洲乱亚洲乱淫久久| 久久久精品一区二区三区| 国产人久久人人人人爽| 97精品伊人久久久大香线蕉 | 国产99精品久久| 久久精品中文字幕久久| 久久96国产精品久久久| 久久天天躁狠狠躁夜夜躁2O2O| 久久国产免费直播| 狠狠色婷婷久久一区二区| 久久综合亚洲鲁鲁五月天| 久久综合久久综合亚洲| 亚洲人成无码久久电影网站| 伊色综合久久之综合久久| 欧美精品乱码99久久蜜桃| 久久国产免费直播| 国产精品天天影视久久综合网| 久久精品国产福利国产秒|