- #include <shlobj.h>
-
- int main(int argc, char* argv[])
- {
- HRESULT hres;
- IShellLink* psl;
- WORD wsz[MAX_PATH];
-
- CoInitialize(NULL);
- hres = CoCreateInstance(CLSID_ShellLink, NULL,CLSCTX_INPROC_SERVER,
- IID_IShellLink, (LPVOID *)&psl);
-
- if (SUCCEEDED(hres))
- {
- IPersistFile* ppf;
- psl->SetPath("C:\\WINDOWS\\explorer.exe");
- psl->SetDescription("Explorer");
- psl->QueryInterface(IID_IPersistFile,(LPVOID *)&ppf);
-
- MultiByteToWideChar(CP_ACP, 0,"c:\\racourci.lnk", -1,(LPWSTR)wsz, MAX_PATH);
-
- ppf->Save((LPWSTR)wsz, TRUE);
- ppf->Release();
- }
- psl->Release();
- CoUninitialize();
-
- return 0;
- }
#include <shlobj.h>
int main(int argc, char* argv[])
{
HRESULT hres;
IShellLink* psl;
WORD wsz[MAX_PATH];
CoInitialize(NULL);
hres = CoCreateInstance(CLSID_ShellLink, NULL,CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID *)&psl);
if (SUCCEEDED(hres))
{
IPersistFile* ppf;
psl->SetPath("C:\\WINDOWS\\explorer.exe");
psl->SetDescription("Explorer");
psl->QueryInterface(IID_IPersistFile,(LPVOID *)&ppf);
MultiByteToWideChar(CP_ACP, 0,"c:\\racourci.lnk", -1,(LPWSTR)wsz, MAX_PATH);
ppf->Save((LPWSTR)wsz, TRUE);
ppf->Release();
}
psl->Release();
CoUninitialize();
return 0;
}