diff --git a/launcher/CmderLauncher.sln b/launcher/CmderLauncher.sln index 9b4bc6562..9a0402d3f 100644 --- a/launcher/CmderLauncher.sln +++ b/launcher/CmderLauncher.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.23107.0 diff --git a/launcher/CmderLauncher.vcxproj b/launcher/CmderLauncher.vcxproj index 08deaeb9b..286876f1c 100644 --- a/launcher/CmderLauncher.vcxproj +++ b/launcher/CmderLauncher.vcxproj @@ -14,13 +14,12 @@ {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3} Win32Proj CmderLauncher - 10.0.16299.0 Application true - v141_xp + v140 Unicode @@ -28,7 +27,7 @@ false true Unicode - v141 + v140 @@ -60,6 +59,7 @@ Windows true + src/app.manifest %(AdditionalManifestFiles) @@ -86,6 +86,7 @@ true true true + src/app.manifest %(AdditionalManifestFiles) @@ -95,7 +96,7 @@ - + RC diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 9f0a27596..ad952eefc 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -9,6 +9,7 @@ #include #pragma comment(lib, "Shlwapi.lib") +#pragma comment(lib, "comctl32.lib") #pragma warning( disable : 4091 ) #ifndef UNICODE @@ -29,6 +30,39 @@ #define FAIL_ON_ERROR(x) { DWORD ec; if ((ec = (x)) != ERROR_SUCCESS) { ShowErrorAndExit(ec, __WFUNCTION__, __LINE__); } } +void TaskDialogOpen( PCWSTR mainStr, PCWSTR contentStr ) +{ + + HRESULT hr = NULL; + + TASKDIALOGCONFIG tsk = {sizeof(tsk)}; + + HWND hOwner = NULL; + HINSTANCE hInstance = GetModuleHandle(NULL); + PCWSTR tskTitle = MAKEINTRESOURCE(IDS_TITLE); + + tsk.hInstance = hInstance; + tsk.pszMainIcon = MAKEINTRESOURCE(IDI_CMDER); + tsk.pszWindowTitle = tskTitle; + tsk.pszMainInstruction = mainStr; + tsk.pszContent = contentStr; + + TASKDIALOG_BUTTON btns[1] = { + { IDOK, L"OK" } + }; + + tsk.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION|TDF_ENABLE_HYPERLINKS; + tsk.pButtons = btns; + tsk.cButtons = _countof(btns); + + tsk.hwndParent = hOwner; + + int selectedButtonId = IDOK; + + hr = TaskDialogIndirect( &tsk, &selectedButtonId, NULL, NULL ); + +} + void ShowErrorAndExit(DWORD ec, const wchar_t * func, int line) { wchar_t * buffer; @@ -460,7 +494,12 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i]; } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + wchar_t validOptions[512]; + HMODULE hMod = GetModuleHandle(NULL); + LoadString(hMod, IDS_SWITCHES, validOptions, 512); + + // display list of valid options on unrecognized parameter + TaskDialogOpen( L"Unrecognized parameter.", validOptions ); cmderOptions.error = true; } } diff --git a/launcher/src/resource.h b/launcher/src/resource.h index 709cf9d8d..0c06c299f 100644 Binary files a/launcher/src/resource.h and b/launcher/src/resource.h differ diff --git a/launcher/src/Resource.rc b/launcher/src/resource.rc similarity index 99% rename from launcher/src/Resource.rc rename to launcher/src/resource.rc index 55e277282..28d39803d 100644 --- a/launcher/src/Resource.rc +++ b/launcher/src/resource.rc @@ -9,6 +9,7 @@ #include "resource.h" #include "version.rc2" +#include "strings.rc2" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// diff --git a/launcher/src/strings.rc2 b/launcher/src/strings.rc2 new file mode 100755 index 000000000..e581513c2 --- /dev/null +++ b/launcher/src/strings.rc2 @@ -0,0 +1,12 @@ + +///////////////////////////////////////////////////////////////////////////// +// Corresponding ids should be defined in `resource.h` file. + +STRINGTABLE +{ + IDS_TITLE "Cmder Launcher" + + IDS_SWITCHES L"Valid options:\n\n /c [CMDER User Root Path]\n /task [ConEmu Task Name]\n [/start [Start in Path] | [Start in Path]]\n /single\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]" +} + +/////////////////////////////////////////////////////////////////////////////