//代码如下:

HRESULT hr = CoInitialize(NULL);
 if (SUCCEEDED(hr))
 {
  IShellLink *pisl;
  hr = CoCreateInstance(CLSID_ShellLink, NULL,
       CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pisl);
  if (SUCCEEDED(hr))
  {
   IPersistFile* pIPF;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

//这里是我们要创建快捷方式的原始文件地址
   pisl->SetPath("c:\\windows\\notepad.exe");
   hr = pisl->QueryInterface(IID_IPersistFile, (void**)&pIPF);
   if (SUCCEEDED(hr))
   {

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

//这里是我们要创建快捷方式的目标地址


    pIPF->Save(L"c:\记事本.lnk", FALSE);
    pIPF->Release();
   }
   pisl->Release();
  }
  CoUninitialize();
 }

That's all.

相关文章:

  • 2021-08-03
  • 2021-04-15
  • 2022-02-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-01
  • 2021-08-18
  • 2022-12-23
  • 2021-12-08
相关资源
相似解决方案