+2013-08-21 Keith Marshall <keithmarshall@users.sourceforge.net>
+
+ Simplify guimain.exe duplicate instance prevention.
+
+ * src/guimain.cpp (WinMain): Delegate requisite checking to...
+ (WTK::RaiseAppWindow): ...this external toolkit function.
+
2013-08-13 Keith Marshall <keithmarshall@users.sourceforge.net>
Install licence as standard setup component.
* so first, we check to ensure that there is no other instance
* already running...
*/
- HWND AppWindow = FindWindow(
- StringResource( Instance, ID_MAIN_WINDOW_CLASS ), NULL
- );
- if( (AppWindow != NULL) && IsWindow( AppWindow ) )
- {
- /* ...and when one is, we identify its active window...
- */
- HWND AppPopup = GetLastActivePopup( AppWindow );
- if( IsWindow( AppPopup ) )
- AppWindow = AppPopup;
-
- /* ...bring it to the foreground...
- */
- SetForegroundWindow( AppWindow );
+ if( WTK::RaiseAppWindow( Instance, ID_MAIN_WINDOW_CLASS ) )
/*
- * ...restore it from minimised state, if necessary...
- */
- if( IsIconic( AppWindow ) )
- ShowWindow( AppWindow, SW_RESTORE );
-
- /* ...and defer execution to it.
+ * ...and when one is, we defer execution to it.
*/
return EXIT_SUCCESS;
- }
/* There is no running instance of mingw-get; before we create one,
* ensure we can acquire an exclusive lock for the XML catalogue.
* instance of the mingw-get GUI application window.
*/
AppWindowMaker MainWindow( Instance );
- AppWindow = MainWindow.Create(
+ HWND AppWindow = MainWindow.Create(
StringResource( Instance, ID_MAIN_WINDOW_CLASS ), MainWindowCaption
);