Mercurial > octave
changeset 22153:bbaeaed0c584
set AppUserModelId for application in Windows (bug #47527)
* libgui/src/octave-gui.cc:
(set_win_app_id): new function
(gui_application::start_gui_p): add call to set_win_app_id in windows
author | John Donoghue |
---|---|
date | Wed, 20 Jul 2016 16:33:58 -0400 |
parents | 19d54df7d719 |
children | ff54e7882863 |
files | libgui/src/octave-gui.cc |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/octave-gui.cc Wed Jul 20 10:20:20 2016 -0700 +++ b/libgui/src/octave-gui.cc Wed Jul 20 16:33:58 2016 -0400 @@ -63,6 +63,29 @@ { } +#if defined (OCTAVE_USE_WINDOWS_API) +// set app id if we have the SetCurrentProcessExplicitAppUserModelID +// available (>= Win7) +static void +set_win_app_id () +{ + typedef HRESULT (WINAPI *SETCURRENTAPPID)(PCWSTR AppID); + HMODULE hShell = LoadLibrary ("shell32.dll"); + if (hShell != NULL) + { + SETCURRENTAPPID pfnSetCurrentProcessExplicitAppUserModelID = + reinterpret_cast<SETCURRENTAPPID> (GetProcAddress (hShell, + "SetCurrentProcessExplicitAppUserModelID")); + + if (pfnSetCurrentProcessExplicitAppUserModelID) + { + pfnSetCurrentProcessExplicitAppUserModelID (L"gnu.octave"); + } + FreeLibrary (hShell); + } +} +#endif + namespace octave { bool gui_application::start_gui_p (void) const @@ -120,6 +143,10 @@ { octave_thread_manager::block_interrupt_signal (); +#if defined (OCTAVE_USE_WINDOWS_API) + set_win_app_id (); +#endif + std::string show_gui_msgs = octave::sys::env::getenv ("OCTAVE_SHOW_GUI_MESSAGES"); // Installing our handler suppresses the messages.