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);
Irgendwelche Vorschläge, was hier schief geht? < /p>