• <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 幽幽 閱讀(580) 評論(0)  編輯 收藏 引用

            <2008年2月>
            272829303112
            3456789
            10111213141516
            17181920212223
            2425262728291
            2345678

            常用鏈接

            留言簿(6)

            隨筆分類(35)

            隨筆檔案(51)

            文章分類(3)

            文章檔案(3)

            相冊

            我的鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            国产精品永久久久久久久久久| 中文字幕久久波多野结衣av| 亚洲av伊人久久综合密臀性色| 人妻久久久一区二区三区| 77777亚洲午夜久久多喷| 久久久久久青草大香综合精品| 久久精品国产亚洲AV蜜臀色欲| 伊人久久精品线影院| 一级A毛片免费观看久久精品| 女人香蕉久久**毛片精品| 亚洲日韩中文无码久久| 国产精品久久国产精麻豆99网站| 国产精品丝袜久久久久久不卡| 久久成人国产精品免费软件| 久久香蕉国产线看观看99| 漂亮人妻被中出中文字幕久久| 久久久久久亚洲精品不卡 | 色综合久久中文色婷婷| 亚洲伊人久久成综合人影院| 狠狠狠色丁香婷婷综合久久俺| 一本久久a久久精品亚洲| 伊人久久免费视频| 久久这里只有精品18| 国产精品久久久久久久久软件| 国内精品免费久久影院| 亚洲综合精品香蕉久久网97| 日韩精品久久久肉伦网站| 日韩久久无码免费毛片软件| 久久最新免费视频| 国产成人综合久久精品红| 国产ww久久久久久久久久| 97r久久精品国产99国产精| 亚洲AV日韩精品久久久久久久| 久久午夜福利无码1000合集| 久久综合色之久久综合| 精品无码人妻久久久久久| 91精品国产色综久久| 99久久www免费人成精品| 国产精品无码久久久久| 久久国产三级无码一区二区| 精品综合久久久久久88小说|