[Mono-dev] Getting and injecting Windows Forms messages

Peter Dennis Bartok peter at novonyx.com
Sun Nov 20 22:57:48 EST 2005


Pablo,

The better list for this discussion is mono-winforms-list at lists.ximian.com.

If you look at our tests (for example 
mcs/Managed.Windows.Forms/Tests/System.Windows.Forms/Label.cs) you'll see 
that there already are tests that 'fake' messages for testing purposes, 
since our implementation uses Win32 messages even on X11 and OS X. (Our 
window drivers translate native messages into their Win32 equivalents and 
pass them up through the framework). However, we only use and generate the 
subset of messages that we require for proper support of WinForm's 
documented features. (It is left as an excercise for contributors to add 
other messages if they thing the drivers should generate them. Same applies 
to controls, we don't create control-specific notifications like BN_CLICKED 
today, since the managed framework has events that convey the same 
information and we don't need them, but for compatibility it is easy to add 
generation of those down the road. Single line of code most of the time)

There's already an automated test tool called nunit-winforms that allows to 
test winforms apps, it doesn't fully work with our WinForms implementation 
yet (something that's I've started fixing and is on my todo list).

As for injecting messages, I can think of multiple ways of doing that, from 
using reflection to using sendmessage (and on X11 translating that into a 
custom message that our driver understands)

Cheers,
  Peter



-----Original Message-----
From: <pablosantosluac at terra.es>
To: <mono-devel-list at lists.ximian.com>
Date: Sunday, 20 November, 2005 17:04
Subject: [Mono-dev] Getting and injecting Windows Forms messages


>Hi,
>
>In order to retrieve all the messages processed by an application I think I
>can use Application.AddMessageFilter. Ok, but what about injecting them
>later on?
>
>Well, in windows I could use TranslateMessage/DispatchMessage to reinject
>the "recorded" messages (at least in win32 apps), (BTW fixing msg.Hwnd with
>the correct value if you try to "play" after relaunching the application),
>but with mono (on Linux) this is not possible. Is there a way to do that?
>
>With something like that it would be possible to write a multi-platform
>"test recorder" application for Mono, something to create and run 
>"automated
>user tests" on both Windows and Linux (and maybe other platforms too...). I
>don't know such a tool (AFAIK WinRunner, Rational's TestRobot, 
>AutomatedQA's
>TestComplete, and the like, only run on Windows) and maybe it would be 
>quite
>interesting... (at least until we have an Automation namespace like 
>Avalon).
>
>Thanks.
>
>
>_______________________________________________
>Mono-devel-list mailing list
>Mono-devel-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
> 




More information about the Mono-devel-list mailing list