views:

87

answers:

1

Hello! I have three questions about editbox control in WINAPI (i can't find information on msdn about this) 1. How to disable moving typeing cursor with mouse, arrows, backspace in editbox ? I want to make typing like in command line in dos, but with out backspace.

  1. Can I write some piece of text with red color, and another with blue ?

  2. How to write to editbox control from another thread ?

A: 
  1. Make it read-only (ES_READONLY) & manually intercept keystrokes and append only those you want to.
  2. No, you would need to use a RICHEDIT class for that and use RTF. (You could owner draw a normal EDIT window but that would not be much fun)
  3. SendMessage with WM_SETTEXT (Or EM_SETTEXTEX / EM_REPLACESEL if you use a RICHEDIT)

Why not use a Console?

Alex K.
It must be in window :/To answer 1. - Are there any other option instead of ES_READONLY and intercept keystrokes ? I asking beacouse in my language there is a lot of combinations on keyboard to make variuos characters.
subSeven
Alex K.
Thx.Can I disable mouse selection in richedit ?I append char with this code: SendMessage(richEdit, EM_SETSEL, - 1, 0); SendMessage(richEdit,EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) SendMessage(richEdit, EM_REPLACESEL, (WPARAM)0, (LPARAM)(LPSTR)msg); But when I click on richedit with mouse this code doesn't work :/
subSeven
You could discard mouse messages, WM_LBUTTONDOWN et al.
Alex K.