I would like to use simple dll compiled in Mono(GTK), in WinForms in Visual Studio.
I added references in VS to gtk-sharp, Mono.Cairo/Posix, gtk-dotnet, atk-sharp
I'm starting to work with mono and before I proceed to work on more important things in mono I have to make sure that the dlls written in mono, will work with other projects in Visual Studio. Could someone give an example of code that will open a the windows/dilalog in WinForms?
When I'm running my code, i get an error:
System.AccessViolationException was unhandled
HResult=-2147467261
Message=Attempted to read or write protected memory. Often, this indicates that the other memory is corrupt.
Source=gtk-sharp
StackTrace:
w Gtk.Dialog.gtk_dialog_run(IntPtr raw)
w Gtk.Dialog.Run()
w dllTest.MessageBox.Show(String Msg)
w dllTest.MyClass.Test()
w AllegroParser.Form1.Form1_Load(Object sender, EventArgs e) w C:\Users\KrzysiekJ\Documents\Visual Studio 2010\Projects\AllegroParser\AllegroParser\Form1.cs:wiersz 23
w System.Windows.Forms.Form.OnLoad(EventArgs e)
w System.Windows.Forms.Form.OnCreateControl()
w System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
w System.Windows.Forms.Control.CreateControl()
w System.Windows.Forms.Control.WmShowWindow(Message& m)
w System.Windows.Forms.Control.WndProc(Message& m)
w System.Windows.Forms.ScrollableControl.WndProc(Message& m)
w System.Windows.Forms.ContainerControl.WndProc(Message& m)
w System.Windows.Forms.Form.WmShowWindow(Message& m)
w System.Windows.Forms.Form.WndProc(Message& m)
w System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
w System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
w System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Dll code:
namespace dllTest
{
public class MyClass
{
public MyClass ()
{
}
public void Test ()
{
MessageBox.Show ("test");
}
}
public class MessageBox
{
public static void Show(string Msg)
{
MessageDialog md = new MessageDialog (null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, Msg);
md.Run ();
md.Destroy();
}
}
}
Simple app in WinForms:
dllTest.MyClass mc = new dllTest.MyClass();
mc.Test();