A small 'realtime' console redirection lib for Pelles C.
These use pipestuffer.exe, a 2018 update to RTconsole that handles win10 issues.
The original C++ for Olivier Marcoux's 2018 update to RTconsole, pipestuffer.cpp:
https://github.com/buck54321/PipeStufferI adapted pipestuffer.cpp to C for use in Pelles C and added some functions that
make it easier to manage realtime console redirection for GUI use.
Pelles C Projects:
easypipeLib.zip The static library for windows projects
pipestufferProj.zip The 2018 update to RTconsole, but in C for Pelles C
testDlgProj.zip An example showing pipestuffer and easylib's use.
Note: I compiled for multithreaded 64-bit in all projects, just a heads-up.
All you need is a multiline edit control. There are only three functions to call,
two on create to initialize a struct and one that spawns the console and redirects
it to your edit control, see the example testDlg.c.
static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
char *cmd="testconsole.exe"; //the console to run
switch (uMsg)
{
case WM_INITDIALOG:
initpipe(); //init first...
loadpipe(hwnd, "pipe01", cmd, IDC_EDIT); //then load the struct - done!
return TRUE;
case WM_SIZE:
return TRUE;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDB_PROC:
enablepipe(); //click to run the console
return TRUE;
case IDOK:
EndDialog(hwnd, TRUE);
return TRUE;
}
break;
case WM_CLOSE:
EndDialog(hwnd, 0);
return TRUE;
case WM_CTLCOLORSTATIC: //make the edit look 'console-ish'
return onCTLCOLORSTATIC(hwnd, wParam);
}
return FALSE;
}
If you find any errors, anomalies or leaks, fix 'em - you've got the code.
tony74 03/09/2019