From 8a916369324e4fea06f267531d1e2148715ecb08 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 29 Dec 2014 15:02:05 +0100 Subject: [PATCH] Use SHOpenWithDialog if possible Signed-off-by: Sven Strickroth --- src/TortoiseProc/AppUtils.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/TortoiseProc/AppUtils.cpp b/src/TortoiseProc/AppUtils.cpp index 0295c723b..0b73951a7 100644 --- a/src/TortoiseProc/AppUtils.cpp +++ b/src/TortoiseProc/AppUtils.cpp @@ -3614,8 +3614,21 @@ int CAppUtils::ResolveConflict(CTGitPath& path, resolve_with resolveWith) return 0; } -bool CAppUtils::ShowOpenWithDialog(const CString& file, HWND /*hwnd = nullptr */) +bool CAppUtils::ShowOpenWithDialog(const CString& file, HWND hwnd /*= nullptr */) { + CAutoLibrary hShell = AtlLoadSystemLibraryUsingFullPath(_T("shell32.dll")); + if (hShell) + { + typedef HRESULT STDAPICALLTYPE SHOpenWithDialoFN(_In_opt_ HWND hwndParent, _In_ const OPENASINFO *poainfo); + SHOpenWithDialoFN *pfnSHOpenWithDialog = (SHOpenWithDialoFN*)GetProcAddress(hShell, "SHOpenWithDialog"); + if (pfnSHOpenWithDialog) + { + OPENASINFO oi = { 0 }; + oi.pcszFile = file; + oi.oaifInFlags = OAIF_EXEC; + return SUCCEEDED(pfnSHOpenWithDialog(hwnd, &oi)); + } + } CString cmd = _T("RUNDLL32 Shell32,OpenAs_RunDLL "); cmd += file; return CAppUtils::LaunchApplication(cmd, NULL, false); -- 2.11.4.GIT