[Mono-winforms-list] Application.Run() and ContextStripMenu
AutoLyrix (NoWayX)
autolyrix at gmail.com
Mon Jan 21 21:28:25 EST 2008
Hello everyone,
I have an application that does not contain a form. It has a notifyicon only.
So, I have to run my app using Application.Run() and not Application.Run(FORM)
If my notifyIcon has a contextmenustrip I get an exception:
Unhandled Exception: System.NullReferenceException: Object reference
not set to an instance of an object at
System.Windows.Forms.ToolStripDropDown.OnHandleCreated
(System.EventArgs)
The line that raise the exception inside ToolStripDropDown.cs is (line 564)
XplatUI.SetOwner (this.Handle,
Application.MWFThread.Current.Context.MainForm.Handle);
I attached one example that generates the exception. Compile it with
-res:test.ico,test.Resources.test.ico (copy the test.ico from
somewhere), so it has an icon.
If you change the class Controller to inherit from the class Form and
call Application.Run(controller) it works just fine.... (but of
course, it shows a form!)
But I dont want to create a form... does anyone know how to fix this?
Does anyone have suggestions?
Thanks,
Alex
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test2.cs
Url: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20080121/2fdb40ca/attachment.pl
More information about the Mono-winforms-list
mailing list