+ chg: Command Line Help: using sizeable dialog box instead of auto-sized MessageBox

This commit is contained in:
Rainer Kottenhoff 2018-11-13 12:03:15 +01:00
parent faff0e0f3a
commit 012d5cdad4
6 changed files with 102 additions and 2 deletions

View File

@ -192,7 +192,7 @@
#define IDD_MUI_ENCODING 17030
#define IDD_MUI_ALIGN 17031
#define IDD_MUI_CHOOSEFONT 17032
#define IDD_MUI_CMDLINEHELP 17033
#define IDC_COMMANDLINE 18000
#define IDC_SEARCHEXE 18001
@ -285,6 +285,7 @@
#define IDC_COPYVERSTRG 18088
#define IDC_RICHEDITABOUT 18089
#define IDC_TRANSL_AUTH 18090
#define IDC_CMDLINEHELP 18091
#define CMD_ESCAPE 20000
#define CMD_SHIFTESC 20001

Binary file not shown.

View File

@ -250,6 +250,7 @@ INT_PTR InfoBoxLng(int iType, LPCWSTR lpstrSetting, int uidMessage, ...)
//
// DisplayCmdLineHelp()
//
#if 0
void DisplayCmdLineHelp(HWND hwnd)
{
WCHAR szTitle[32] = { L'\0' };
@ -276,7 +277,56 @@ void DisplayCmdLineHelp(HWND hwnd)
MessageBoxIndirect(&mbp);
//MsgBoxLng(MBINFO, IDS_MUI_CMDLINEHELP);
}
#else
INT_PTR CALLBACK CmdLineHelpProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
UNUSED(lParam);
switch (umsg) {
case WM_INITDIALOG:
{
WCHAR szTitle[80] = { L'\0' };
WCHAR szText[2048] = { L'\0' };
GetLngString(IDS_MUI_APPTITLE, szTitle, COUNTOF(szTitle));
GetLngString(IDS_MUI_CMDLINEHELP, szText, COUNTOF(szText));
SetWindowText(hwnd, szTitle);
SetDlgItemText(hwnd, IDC_CMDLINEHELP, szText);
}
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
case IDYES:
case IDNO:
EndDialog(hwnd, LOWORD(wParam));
break;
}
return true;
default:
break;
}
return false;
}
INT_PTR DisplayCmdLineHelp(HWND hwnd)
{
return ThemedDialogBoxParam(Globals.hLngResContainer, MAKEINTRESOURCE(IDD_MUI_CMDLINEHELP), hwnd, CmdLineHelpProc, (LPARAM)L"");
//if (!hwnd) {
// // text to std-out
// //RedirectIOToConsole();
// //fwprintf(stdout, L"\n!!! blahblub ???\n");
// //fflush(stdout);
// //SleepEx(5000,FALSE);
//}
//return(0);
}
#endif
//=============================================================================
//

View File

@ -19,7 +19,8 @@
#include "TypeDefs.h"
int MsgBoxLng(int, UINT, ...);
void DisplayCmdLineHelp(HWND);
//void DisplayCmdLineHelp(HWND);
INT_PTR DisplayCmdLineHelp(HWND hwnd);
bool GetDirectory(HWND,int,LPWSTR,LPCWSTR,bool);
INT_PTR CALLBACK AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
INT_PTR RunDlg(HWND,LPCWSTR);

View File

@ -354,6 +354,9 @@ bool GetDoAnimateMinimize(VOID);
VOID MinimizeWndToTray(HWND hWnd);
VOID RestoreWndFromTray(HWND hWnd);
// console helper from Print.cpp
//void RedirectIOToConsole();
//==== StrCut methods ===================
CHAR* StrCutIA(CHAR* s,const CHAR* pattern);

View File

@ -592,5 +592,50 @@ static void EditPrintInit()
}
}
#if 0
#include <fcntl.h>
#include <io.h>
//#include <iostream>
//#include <fstream>
void RedirectIOToConsole()
{
int hConHandle;
intptr_t lStdHandle;
CONSOLE_SCREEN_BUFFER_INFO coninfo;
FILE *fp;
// allocate a console for this app
AllocConsole();
// set the screen buffer to be big enough to let us scroll text
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
coninfo.dwSize.Y = 500;
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
// redirect unbuffered STDOUT to the console
lStdHandle = (intptr_t)GetStdHandle(STD_OUTPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
fp = _fdopen(hConHandle, "w");
*stdout = *fp;
setvbuf(stdout, NULL, _IONBF, 0);
// redirect unbuffered STDIN to the console
lStdHandle = (intptr_t)GetStdHandle(STD_INPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
fp = _fdopen(hConHandle, "r");
*stdin = *fp;
setvbuf(stdin, NULL, _IONBF, 0);
// redirect unbuffered STDERR to the console
lStdHandle = (intptr_t)GetStdHandle(STD_ERROR_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
fp = _fdopen(hConHandle, "w");
*stderr = *fp;
setvbuf(stderr, NULL, _IONBF, 0);
// make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog point to console as well
std::ios::sync_with_stdio();
}
#endif
// End of Print.cpp