Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: ui/base/win/shell.cc

Issue 8851007: WIP / Do not commit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/win/shell.h ('k') | webkit/glue/webkit_glue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/shell.cc
diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc
index 29efce8f7966f34e49deb49c19141d1400995c48..b58a72909d3dd624187fc2dee6088f9d23843549 100644
--- a/ui/base/win/shell.cc
+++ b/ui/base/win/shell.cc
@@ -77,18 +77,22 @@ void SetAppIdAndIconForWindow(const string16& app_id,
// Open an item via a shell execute command. Error code checking and casting
// explanation: http://msdn2.microsoft.com/en-us/library/ms647732.aspx
-bool OpenItemViaShell(const FilePath& full_path) {
- HINSTANCE h = ::ShellExecuteW(
- NULL, NULL, full_path.value().c_str(), NULL,
- full_path.DirName().value().c_str(), SW_SHOWNORMAL);
-
- LONG_PTR error = reinterpret_cast<LONG_PTR>(h);
- if (error > 32)
+bool OpenItemViaShell(const FilePath& full_path,
+ base::ProcessHandle* process_handle) {
+ SHELLEXECUTEINFO sei = { sizeof(sei) };
+ if (process_handle)
+ sei.fMask = SEE_MASK_NOCLOSEPROCESS;
+ sei.nShow = SW_SHOWNORMAL;
+ sei.lpVerb = NULL;
+ sei.lpFile = full_path.value().c_str();
+ sei.lpDirectory = full_path.DirName().value().c_str();
+ if (::ShellExecuteExW(&sei)) {
+ process_handle = sei.hProcess;
return true;
-
+ }
+ LONG_PTR error = reinterpret_cast<LONG_PTR>(sei.hInstApp);
if ((error == SE_ERR_NOASSOC))
return OpenItemWithExternalApp(full_path.value());
-
return false;
}
« no previous file with comments | « ui/base/win/shell.h ('k') | webkit/glue/webkit_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698