• <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)

            相冊

            我的鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            国产精品一区二区久久精品| 狠狠色丁香久久婷婷综| 蜜桃麻豆www久久国产精品| 色婷婷综合久久久久中文字幕| 久久综合日本熟妇| 麻豆成人久久精品二区三区免费| 99久久免费国产精品热| 亚洲精品成人久久久| 久久精品无码专区免费青青| 99精品久久久久久久婷婷| 久久久久亚洲AV无码观看| 国产韩国精品一区二区三区久久| 国产叼嘿久久精品久久| 国产精品亚洲综合久久| 久久99免费视频| 久久久久亚洲AV无码专区首JN| 国产亚洲婷婷香蕉久久精品| 狠狠色丁香久久婷婷综合_中| 996久久国产精品线观看| 久久久国产精华液| 久久国产成人午夜aⅴ影院| 久久精品aⅴ无码中文字字幕重口| 日韩va亚洲va欧美va久久| 国产精品毛片久久久久久久| 99久久做夜夜爱天天做精品| 99久久精品国产毛片| 国内精品久久国产大陆| 久久综合噜噜激激的五月天| 亚洲精品无码久久久久AV麻豆| 青青热久久综合网伊人| 久久发布国产伦子伦精品 | 亚洲欧美成人综合久久久| 久久久久久A亚洲欧洲AV冫| 久久久中文字幕| 97精品国产97久久久久久免费| 91精品国产9l久久久久| 99久久国产热无码精品免费| 精品久久久久久久无码| 久久国产乱子伦精品免费强| 久久精品国产亚洲av麻豆色欲| 日产精品久久久久久久性色|