大龙的博客

常用链接

统计

最新评论

快捷方式 ---- 转

  • #include "stdafx.h"   
  • #include <windows.h>   
  • #include <shlobj.h>   
  • #include <atlconv.h>   
  •   
  • int _tmain(int argc, _TCHAR* argv[])   
  • {   
  •     CoInitialize( NULL);   
  •   
  •     IShellLink *ipl = NULL;   
  •   
  •     HRESULT hr = CoCreateInstance( CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<LPVOID*>(&ipl));   
  •     if( FAILED(hr))   
  •         return 0;   
  •   
  •     IPersistFile *ipf = NULL;   
  •   
  •     hr = ipl->QueryInterface( IID_IPersistFile, reinterpret_cast<LPVOID*>( &ipf));   
  •     if( FAILED( hr))   
  •         return 0;   
  •   
  •     USES_CONVERSION;   
  •     hr = ipf->Load( T2OLE( _T( "C:\\Documents and Settings\\classyk\\桌面\\PETools.lnk")), STGM_READ);   
  •     if( FAILED( hr)) return 0;   
  •     WCHAR strWorkDir[MAX_PATH];   
  •     ipl->GetPath( strWorkDir, sizeof strWorkDir, 0, SLGP_UNCPRIORITY);   
  •   
  •     ipf->Release();   
  •     ipl->Release();   
  •   
  •     CoUninitialize();
  •     return 0;   
  • }   
  • posted on 2009-09-29 23:29 大龙 阅读(124) 评论(0)  编辑 收藏 引用


    只有注册用户登录后才能发表评论。
    网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理