[Mono-winforms-list] Windows Forms.

Geoff Taylor geoff@opinionatedgeek.com
Tue, 28 Jan 2003 15:31:16 -0000

Simon Ask Ulsnes wrote:
> I have not yet come across a single Windows Control that needed API
> functions. If you know any, please let me know...

I don't know of any way of implementing a caret without resorting to
something like:

[DllImport ("user32.dll")]
public static extern int CreateCaret (IntPtr hwnd, IntPtr hbm, int iWidth,
int iHeight);
[DllImport ("user32.dll")]
public static extern int DestroyCaret ();
[DllImport ("user32.dll")]
public static extern int SetCaretPos (int iX, int iY);
[DllImport ("user32.dll")]
public static extern int ShowCaret (IntPtr hwnd);
[DllImport ("user32.dll")]
public static extern int HideCaret (IntPtr hwnd);

> Besides, I think that programmers that want to achieve cross-platform
> compatibility can cope with the fact that there is no Win32 API on a
> non-Win32 platform, and find another solution.

Like not use a caret?  I'm only kidding, but there are some wholes in the
framework and the way people work around them at the minute is to do
something like the above DllImport.

Should they?  Well, their only options are:

1) Do the DllImport.
2) Write their own caret functionality (which isn't as straightforward as it
may appear).
3) Wait until caret functionality appears in MS' .NET Framework.

It's open to debate what they should do, but most what they _do_ do is use a


http://www.opinionatedgeek.com/ :: Part of the solution.