SuperTrax
Newb

Dabei seit: 25.06.2003
Beiträge: 19
 |
|
Servus,
hab n kleines Problem mit dem Beispielcode von MSDN:
Es geht um das Erstellen eines Links zu einer Datei.
HRESULT CreateLink(LPCSTR lpszPathObj, LPCSTR lpszPathLink, LPCSTR lpszDesc)
{
HRESULT hres;
IShellLinkA* psl;
// Get a pointer to the IShellLink interface.
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*)&psl);
if (SUCCEEDED(hres))
{
IPersistFile* ppf;
// Set the path to the shortcut target and add the description.
psl->SetPath(lpszPathObj);
psl->SetDescription(lpszDesc);
// Query IShellLink for the IPersistFile interface for saving the
// shortcut in persistent storage.
hres = psl->QueryInterface(&IID_IPersistFile, (LPVOID*)&ppf);
if (SUCCEEDED(hres))
{
WCHAR wsz[MAX_PATH];
// Ensure that the string is Unicode.
MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, wsz, MAX_PATH);
// TODO: Check return value from MultiByteWideChar to ensure success.
// Save the link by calling IPersistFile::Save.
hres = ppf->Save(wsz, TRUE);
ppf->Release();
}
psl->Release();
}
return hres;
}
Die richtigen includes hab ich,
allerdings meckert er immer über die Zeile:
hres = psl->QueryInterface(&IID_IPersistFile, (LPVOID*)&ppf);
und sagt: shlobj.h: candidates are: virtual HRESULT
Ich benutze Devc++5.0, eine kostenlose IDE.
Vielleicht kann das ja mal jemand bei sich in Visual C++ laden und schauen, ob es dort funzt.
Oder hat sonst noch jemand ne Idee?
Danke, Gruß Mark
|
|