diff --git a/language/common_res.h b/language/common_res.h index 564cc99e8..9c352259b 100644 --- a/language/common_res.h +++ b/language/common_res.h @@ -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 diff --git a/language/np3_en_us/dialogs_en_us.rc b/language/np3_en_us/dialogs_en_us.rc index cb9e84523..a9b862fb8 100644 Binary files a/language/np3_en_us/dialogs_en_us.rc and b/language/np3_en_us/dialogs_en_us.rc differ diff --git a/src/Dialogs.c b/src/Dialogs.c index af83d0ce9..6fb320608 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -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 //============================================================================= // diff --git a/src/Dialogs.h b/src/Dialogs.h index 8e54f3351..19edf53d2 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -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); diff --git a/src/Helpers.h b/src/Helpers.h index 742f1e293..ca351fffa 100644 --- a/src/Helpers.h +++ b/src/Helpers.h @@ -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); diff --git a/src/Print.cpp b/src/Print.cpp index 1a3dca5ab..cd7c15a5a 100644 --- a/src/Print.cpp +++ b/src/Print.cpp @@ -592,5 +592,50 @@ static void EditPrintInit() } } +#if 0 +#include +#include +//#include +//#include + +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