getting caret

Hi All,
I am a C++ programmer moving to C#. In C++ we can get a caret (not to be confused with the cursor) if we want to. Is it possible to get a caret in C#. I am using it for a text editing program. Any suggestions welcome.
Thnaks.
[255 byte] By [stuckhere90] at [2007-11-19 11:28:17]
# 1 Re: getting caret
When you say caret I assume you mean the insertion point in a TextBox or the like, as opposed to the mouse cursor. Have a look at the TextBoxBase.SelectionStart property.
jmcilhinney at 2007-11-9 1:50:09 >
# 2 Re: getting caret
I am not using a text box at all, nor can I use one. Here is what I would like. The user moves the mouse in the client area of a form. If the user left clicks, then I place the caret there (ideally the caret would be blinking, like in Word) I can do a caret in C++. One would thing C# can to. If it can't, that is a significant drawback for people writing text stuff.
stuckhere80 at 2007-11-9 1:51:09 >
# 3 Re: getting caret
Greetings.

You will find the following win32 functions helpful:

namespace Example
{
public sealed class NativeFunctions
{
private NativeFunctions(){}

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll")]
internal static extern int CreateCarat(IntPtr hWnd, IntPtr hBitmap, int Width, int Height);

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll")]
internal static extern int GetCaratBlinkTime();

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll")]
internal static extern int HideCarat(IntPtr hWnd);

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll")]
internal static extern int SetCaretBlinkTime(int Milliseconds);

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll")]
internal static int ShowCarat(IntPtr hWnd);
}
}

This isn't portable, but it works.

Regards.
SouthernCodeMonkey at 2007-11-9 1:52:09 >