
June 22nd, 2003, 06:18 PM
|
|
Registered User
|
|
Join Date: May 2003
Posts: 25
Time spent in forums: 2 h 51 m 4 sec
Reputation Power: 0
|
|
|
It fails when I try to use the pointer to set a path for my shortcut. The pointer equals NULL. Here's my code:
IShellLink* psl;
hres=CoCreateInstance(
CLSID_ShellLink,
NULL,
CLSCTX_INPROC_SERVER,
IID_IShellLink,
(LPVOID*)&psl
);
if (!SUCCEEDED(hres) || psl==NULL)
{
CoUninitialize();
}
IPersistFile* ppf;
psl->SetPath("C:\\Program Files\\My Program\\program.exe");
psl->SetDescription("Launch Program");
psl->SetIconLocation("C:\\Program Files\\My Program\\program.exe", 0);
psl->QueryInterface(IID_IPersistFile,(LPVOID*)&ppf);
ppf->Save(wLinkPath, FALSE);
ppf->Release();
CoUninitialize();
|