Allow the Escape key to close the GUI.
authorIain Patterson <me@iain.cx>
Fri, 15 Nov 2013 15:50:17 +0000 (15:50 +0000)
committerIain Patterson <me@iain.cx>
Fri, 15 Nov 2013 16:10:42 +0000 (16:10 +0000)
Turns out IDCANCEL is a magic resource name.  If a button has that name
it automatically responds to Escape.

ChangeLog.txt
gui.cpp
nssm.rc

index d4850a3..0317979 100644 (file)
@@ -3,6 +3,8 @@ Changes since 2.17
   * Timeouts for each shutdown method can be configured in
     the registry.
 
+  * The GUI is slightly less sucky.
+
 Changes since 2.16
 -----------------
   * NSSM can now redirect the service's I/O streams to any path
diff --git a/gui.cpp b/gui.cpp
index c45347f..5aaf016 100644 (file)
--- a/gui.cpp
+++ b/gui.cpp
@@ -209,7 +209,7 @@ INT_PTR CALLBACK install_dlg(HWND window, UINT message, WPARAM w, LPARAM l) {
           break;\r
 \r
         /* Cancel button */\r
-        case IDC_CANCEL:\r
+        case IDCANCEL:\r
           DestroyWindow(window);\r
           break;\r
 \r
diff --git a/nssm.rc b/nssm.rc
index d7c9d3b..8574f6c 100644 (file)
--- a/nssm.rc
+++ b/nssm.rc
@@ -70,7 +70,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
     DEFPUSHBUTTON   "Install service",IDC_OK,55,69,50,14\r
-    PUSHBUTTON      "Cancel",IDC_CANCEL,111,69,50,14\r
+    PUSHBUTTON      "Cancel",IDCANCEL,111,69,50,14\r
     EDITTEXT        IDC_PATH,48,7,110,14,ES_AUTOHSCROLL\r
     PUSHBUTTON      "Browse",IDC_BROWSE,163,7,50,14\r
     EDITTEXT        IDC_FLAGS,48,28,165,14,ES_AUTOHSCROLL\r
@@ -161,7 +161,7 @@ LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
     DEFPUSHBUTTON   "Installer le service",IDC_OK,49,69,75,14\r
-    PUSHBUTTON      "Annuler",IDC_CANCEL,131,69,50,14\r
+    PUSHBUTTON      "Annuler",IDCANCEL,131,69,50,14\r
     EDITTEXT        IDC_PATH,48,7,110,14,ES_AUTOHSCROLL\r
     PUSHBUTTON      "Parcourir",IDC_BROWSE,163,7,50,14\r
     EDITTEXT        IDC_FLAGS,48,28,165,14,ES_AUTOHSCROLL\r
@@ -247,7 +247,7 @@ LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
     DEFPUSHBUTTON   "Installa servizio",IDC_OK,49,69,58,14\r
-    PUSHBUTTON      "Annulla",IDC_CANCEL,111,69,50,14\r
+    PUSHBUTTON      "Annulla",IDCANCEL,111,69,50,14\r
     EDITTEXT        IDC_PATH,48,7,110,14,ES_AUTOHSCROLL\r
     PUSHBUTTON      "Sfoglia...",IDC_BROWSE,163,7,50,14\r
     EDITTEXT        IDC_FLAGS,48,28,165,14,ES_AUTOHSCROLL\r