I have written an application (wpf - will Mono translate this for a Mac?) that I wish to somehow port across to Mac OS X. This application involves using user32.dll to perform a mouse click (something like this):
[DllImport("user32.dll")]
static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
I have heard Mono is useful for making applications for multiple platforms - is there a way that I can use this to make my code compatible with a Mac?
If not, is there a way that I can invoke a mouse click using the Mac equivalent of user32.dll? And a way to detect whether the program is running in Windows or Mac OS to choose which bit of code to run?
Mono currently does not plan to support WPF see Link.
Take a look at this SO question to see if it helps and you may want to look into using Silverlight since it is supported by Microsoft on the Mac.
Also you are calling a Win32 native function - those are not supported on Mac. Your best bet would be using cross-platform .NET-strict code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With