33 IShellLinkA* pShellLink =
nullptr;
34 IPersistFile* pPersistFile =
nullptr;
35 char targetPath[MAX_PATH] = {};
39 if (SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkA, (
void**)&pShellLink))) {
40 if (SUCCEEDED(pShellLink->QueryInterface(IID_IPersistFile, (
void**)&pPersistFile))) {
41 std::wstring wpath(lnkPath.begin(), lnkPath.end());
42 if (SUCCEEDED(pPersistFile->Load(wpath.c_str(), STGM_READ))) {
43 if (SUCCEEDED(pShellLink->GetPath(targetPath, MAX_PATH, NULL, SLGP_RAWPATH))) {
44 ret = std::string(targetPath);
47 pPersistFile->Release();
49 pShellLink->Release();
55 throw std::runtime_error(
"yy981/fs::resolveShortcut(): .lnkの解決に失敗");
int start(const std::string app, std::string arg="", const bool wait=false, const std::string &cd="")
外部アプリケーションを起動する(ANSI ビルド版)
int start(const std::string app, std::string arg="", const bool wait=false, const std::string &cd="")
アプリケーションを起動する(.lnk ショートカット対応)