[Mono-devel-list] mono's Windows Forms & MS .Net

Chris Day ChrisD at monkey.biz
Wed May 21 19:18:23 EDT 2003


Windows forms AFAIK is sort of based on COM.  Basically the Main
function of a winforms app has a [STAThread] attribute which is
Single-Threaded Apartment.  Basically what this means is that COM (and
Windows) talks to the process via a message pump, with the messages
usually then processed and dispatched and handled in the WndProc method
of a winform.  The thread which handles the windows messages is also
called the UI Thread.
 
However winforms still talks to Windows directly (well if you consider
P/Invoke direct ;)
 
Basically for all messages (ie. mouse moved, repaint yourself, etc)
windows communicates with the winform via the message pump.  Also _some_
gui updates require messages go through the message pump (ie. you need
to call Invoke on the control you're updating with a delegate to the
method to do the updating, which then calls the delegate on the UI
Thread), but it does not mean that a winform app is or required to be
single-threaded.
 
To summarise
    - winforms message pump runs on a single thread, aka UI Thread
    - winforms talks "directly" to kernel (aka Win32 API)
 
In terms of mono's winforms working on WinXX, I would suggest that if
there is in place a process to handle windows messages then they should
work fine.  I have no idea, but I guess this is what GTK does for you on
WinXX.
 
Chris

-----Original Message-----
From: Urs Muff [mailto:umuff at quark.com] 
Sent: Thursday, 22 May 2003 12:32 AM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-devel-list] mono's Windows Forms & MS .Net



The MS Windows forms have a major drawback; they are based on COM and
are single threaded.  That means they are not using the underlying
kernel directly, but using COM to talk to it.

As far as I know mono's Windows forms are directly written on top of the
kernel.  Is that correct?

Do mono's Windows forms have a threading restriction?

What is the status of Windows forms on Win32 [WinNT/WinXP/Win2k3
Server]?

Would it be possible to use [did anyone try to use] mono's Windows form
in the MS .Net CLR?  What could be possible problems?  Does the forms
implementation rely on anything special in the mono runtime?

Thanks a lot for your answer.

- Urs C. Muff
Software Architect      - Research Lab
Quark Inc.

UMuff at Quark.Com         - X6360







More information about the Mono-devel-list mailing list