Originally Posted by
stefan63
About "Enter" catching:
- i monitored WM_COMMAND , but didnt find IDOK and IDCANCEL.
On pucture You can see what i see (not very helpful probably).
Here 140 is ID for "history", 131 is ID for "input". (hiL,loL,hiW,loW - LPARAM,WPARAM)
EN_MAXTEX notificatios appeared after i settled "input" to be multyline style.
Even now is working, but probably i'm missing something.
Did you monitor it with my message dispatcher?
IDOK and IDCANCEL are produced by IsDialogMessage()...
-About "history" window.
I tryed first Listbox , but didnt find "scrolling" possibilities/keys,
history was without scrollbars and "stopped" on last visible line,
so i switched to Edit control. Tomorrow i'll search again.
Try something like this...
To create your listbox...
Code:
// Log window
LogWind = CreateWindowEx(WS_EX_STATICEDGE,L"LISTBOX",NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP |
LBS_NOINTEGRALHEIGHT | LBS_NOSEL,
238,5,300,250,Wind[0],NULL,PgmInst,NULL);
Then manage it like this....
(This has a bunch of extra stuff in it, but I bolded the parts you should be interested in)
Code:
// write a log entry
VOID AddToLog(PWCHAR Action, PWCHAR Extra)
{ TCHAR ls[MAX_LOGLINE] = {0}; // log string
DWORD sp = 0; // array pointer
INT li; // list item
// insert the date
sp = GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,NULL,NULL,ls,20);
// add a space
ls[sp-1] = L' ';
// add the time
sp += GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT,NULL,NULL,&ls[sp],20);
// another space
lstrcat(ls,L" -> ");
// space
lstrcat(ls,Action);
lstrcat(ls,L" -> ");
// tag on extra info
if (Extra)
lstrcat(ls,Extra);
// trim log
while (SendMessage(LogWind,LB_GETCOUNT,0,0) > Setting.LogLines)
SendMessage(LogWind,LB_DELETESTRING,0,0);
// add new message
li = SendMessage(LogWind,LB_ADDSTRING,0,(LPARAM) &ls);
// scroll if not selected
if (GetForegroundWindow() != LogWind)
{ SendMessage(LogWind,LB_SETCURSEL,li,0);
SendMessage(LogWind,LB_SETCURSEL,-1,0); }
UpdateWindow(LogWind); }
About color.
Edit Control Text Operations (Windows)
Here i read something(Complex Script in Edit Controls), which isnt very clear for me.
I understand this, that text in Edit control can contain control/script sequences, which can
change display properties of text even at line or character level. But probably i'm wrong.
Yep, there are wasy to do that. In fact the RichEdit control has most of that built in... but it's a lot of work to manage...
How about posting your code so I can get a better look?