A simple text editor program design prototype production --windows

For the text editor, the most critical knowledge, is the caret is operated ...

There are five basic windows caret functions:

  CreateCaret: Creating and window associated caret

  SetCaretPos: Set caret position in the window

  ShowCaret: display caret

  HideCaret: hidden caret

  DestroyCaret: destroy the caret

For caret correlation function:

  GetCaretPos: function to obtain the current location of the caret

  GetCaretBlinkTime SetCaretBlinkTime function of time is obtained and set flashing caret

News about the caret capture:

And by processing the program WM_SETFOCUS WM_KILLFOCUS message to decide whether it has input focus.

When the program receives input focus is WM_SETFOCUS receiving a message. When the program loses the input focus, you receive a WM_KILLFOCUS.

These messages are in pairs.

Caret main rule :

  CreateCaret function call in the window procedure WM_SETFOCUS messages. When the window handle WM_KILLFOCUS messages, call DestroyCaret function.

Detailed code is as follows:

Reproduced in: https: //my.oschina.net/u/204616/blog/545001

Guess you like

Origin blog.csdn.net/weixin_34405354/article/details/91990198