1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
consolewindow(string strTitle="")
{
static int i=0;
i=i+1;
if(strTitle=="")
strTitle="Console " + to_string(i);
frmconsolewindow.Text=strTitle;
LoadLibrary(TEXT("Msftedit.dll"));
consoleedit = CreateWindowEx(0,"RICHEDIT50W", TEXT("hello editor "),
WS_CHILD | WS_VISIBLE | ES_WANTRETURN | ES_MULTILINE | ES_AUTOHSCROLL|ES_AUTOVSCROLL| WS_VSCROLL | WS_HSCROLL, 0, 0,
frmconsolewindow.width-16, frmconsolewindow.height -38 , frmconsolewindow, 0, GetModuleHandle(0), 0 ) ;
wpOrigRichEditProc=(WNDPROC)SetWindowLong(consoleedit,GWL_WNDPROC,(LONG_PTR)consolewindow::RichEditProc);
SetWindowLongPtr(consoleedit,GWLP_USERDATA,(LONG) this);
SendMessage( consoleedit, EM_SETBKGNDCOLOR, 0, RGB( 0,0,0 ) );
CHARFORMAT2 cf;
cf.dwEffects =0;
cf.dwMask = CFM_COLOR;
cf.crTextColor =RGB(255,255,255);
cf.cbSize = sizeof(CHARFORMAT2);
SendMessageA(consoleedit, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf );
frmconsolewindow.GetFocus=[&]()
{
SetFocus(consoleedit);
};
frmconsolewindow.Resize=[&]()
{
SetWindowPos(consoleedit,0,0,0,frmconsolewindow.width-16, frmconsolewindow.height -38 ,SWP_NOMOVE|SWP_NOREPOSITION|SWP_NOZORDER);
};
frmconsolewindow.Close=[&]()
{
blnread=false;
};
pthread_mutex_init(&myMutex,NULL);
}
|