Ipersistfile -Last undefinierter Rückgabewert

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Ipersistfile -Last undefinierter Rückgabewert

by Anonymous » 09 Mar 2025, 11:09

Ich versuche derzeit, das Beispiel zu portieren, das eine Verknüpfung der MSDN auf eine QT -Anwendung auflöst, die mit Mingw 4.8.1 erstellt wurde.

Code: Select all

QFileInfo shortcut("C:\\Users\\MyUserName\\ShortCut.lnk");

HRESULT apiResult;
IShellLink *shellLink;

apiResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*) &shellLink);

IPersistFile *persistFile;
apiResult = shellLink->QueryInterface(IID_IPersistFile, (void**) &persistFile);

WCHAR shortcutLocationWchar[MAX_PATH];
QString shortcutLocation = QDir::toNativeSeparators(shortcut.absoluteFilePath());
shortcutLocation.toWCharArray(shortcutLocationWchar);

apiResult = persistFile->Load(shortcutLocationWchar, STGM_READ);

apiResult = shellLink->Resolve(NULL, SLR_NO_UI);

WCHAR shortcutTargetWchar[MAX_PATH];
WIN32_FIND_DATA winFindData;
apiResult = shellLink->GetPath(shortcutTargetWchar, MAX_PATH, &winFindData, 0);

QString shortcutTarget = QString::fromWCharArray(shortcutTargetWchar);
Im Moment ipersistFile :: laden fällt mit Rückgabewert 0x80070002 fehl, was weder in seinem API -Dokument definiert ist, noch der Winer.h Header noch Google scheint mit nützlichen Ergebnissen zu kommen. < /p>

Irgendwelche Vorschläge, was hier schief geht? < /p>

Top