HideCaret & RichTextBox

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

Greetings,

I'm trying to use the HideCaret() function, but I can't
seem to get the HWND for the richtextbox control, which
is required for HideCaret(). Does anyone have an example
of how this is done?

Any help would be appreciated.

Thanks,
Kevin
 
The HWND can be obtained through the Handle property
Its type is IntPtr so make sure you define HideCaret as taking
IntPtr aswell

/claes
 
* "Kevin said:
I'm trying to use the HideCaret() function, but I can't
seem to get the HWND for the richtextbox control, which
is required for HideCaret(). Does anyone have an example
of how this is done?

Untested:

\\\
Private Declare Function HideCaret Lib "user32.dll" ( _
ByVal hwnd As IntPtr _
) As Int32

Private Sub TextBox1_TextChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs _
) Handles TextBox1.TextChanged
HideCaret(Me.TextBox1.Handle)
End Sub

Private Sub TextBox1_MouseDown( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs _
) Handles TextBox1.MouseDown
HideCaret(Me.TextBox1.Handle)
End Sub

Private Sub TextBox1_Enter( _
ByVal sender As Object, _
ByVal e As System.EventArgs _
) Handles TextBox1.Enter
HideCaret(Me.TextBox1.Handle)
End Sub
///
 
I'm using C++ .net, and here's the function I'm using in
various events to make the cursor go bye-bye, but it's
not working. :( The cursor is still happily blinking
away.

HideCaret(richTextBox1->Handle.ToPointer());

Any ideas?

Thanks!

Kevin
 
Hi,

Okay, here is my code:

HideCaret((HWND)richTextBox1->Handle.ToPointer());

It compiles fine, but still does not appear to be
working. I put it in various events, at least enough to
know of something works. Any suggestions?

Thanks!
Kevin
 
Back
Top