2021年1月7日星期四

How do I create a Shortcut with a folder in the Start Menu on Windows

So far I can create a Shortcut in the Start Menu.

enter image description here

I want to create this Shortcut wiht a folder,and this folder is in the Start Menu.

enter image description here

What should I do?Thanks for your help!

Here are my code:

void CreateShort(CString strApp, char* pcLnk)   {      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(strApp);                    hr = pisl->QueryInterface(IID_IPersistFile, (void**)&pIPF);            if(SUCCEEDED(hr))          {              USES_CONVERSION;              LPCOLESTR lpOlestr = A2COLE(pcLnk);              hr = pIPF->Save(lpOlestr, FALSE);                if (SUCCEEDED(hr))              {              }              else              {                  DWORD dw = GetLastError();                  AfxMessageBox(dw);              }              pIPF->Release();          }          pisl->Release();      }  }  CoUninitialize();  }  
https://stackoverflow.com/questions/65622465/how-do-i-create-a-shortcut-with-a-folder-in-the-start-menu-on-windows January 08, 2021 at 10:04AM

没有评论:

发表评论