Re: Timers
If you want to let windows handle the caret for you, you can call
::CreateCaret(m_hWnd,NULL,WidthofCaret,HeightofCaret);
and then when you want to show it you call ShowCaret. Don't forget to
destory the caret when you are done with it. The blink rate can be set using
SetCaretBlinkTime
http://msdn.microsoft.com/en-us/library/ms646968(VS.85).aspx
As far as setting the caret pos (SetCaretPos), you will have to calculate
the position yourself, there are two functions that will come in handy, one
is GetTextExtent, and the other is DrawText with DT_CALCRECT. The latter
will help only if you have a multi-line control.
AliR.
"vvf" <vvf@vvf.com> wrote in message
news:eKCROEOIKHA.1380@TK2MSFTNGP02.phx.gbl...
Hi,
As an exercise, I am implementing an "edit box" from scratch (including
text drawing, etc) and now I need to make the cursor blink.
But in this case just handle the caret - it blinks all by itself.
OK.. so, before I dig into MSDN, can I handle the caret over a static
control ? I basically have my window derived from a CStatic; please note
that I am doing all the text drawing (i.e., I am not using any text
functions, I actually draw letters onto the DC using a text class that I
implemented) so now the question is, if I would be able to place the caret
at certain coordinates over a static control ..
My CStatic derived controls is owner-drawn..
Thanks.
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4347 (20090819) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4348 (20090819) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com