?
=?ISO-8859-1?Q?Linus_R=F6rstad?=
Hi!
I'm have a bit of a problem with the
OpenNETCF.Windows.Forms.ApplicationEx.ShowDialog() function when using
it with the IMessageFilter class. I have created a class which inherites
from the IMessageFilter class to get WM messages for all the forms in
my application. This works great to get the messages but I have
discovered some problems when I want to use it on all the forms.
I start my application by using ApplicationEx.Run to display my main
form. I call ApplicationEx.AddMessageFilter to add my form and register
a function to recieve the messages for this form. When I push a button
on the main form it will display a second form by using
ApplicationEx.ShowDialog and I will also register this form to recieve
messages. So far everything is great. I will recive the messages in the
second form too. But when I close the second form the application will
throw two ObjectDisposedExceptions.
I have tried to solve this by setting the disposeForm parameter to false
when calling ShowDialog and this works but the form is then not closed,
only hidden behind the main form. And when I close the second form from
the main form I still get the ObjectDisposedExceptions.
I have also tried to remove the messagefilter in the main form before
calling ShowDialog without success. I have DialogResult set before
closing the second form.
Any solution to this?
Sincerely
Linus Rörstad
I'm have a bit of a problem with the
OpenNETCF.Windows.Forms.ApplicationEx.ShowDialog() function when using
it with the IMessageFilter class. I have created a class which inherites
from the IMessageFilter class to get WM messages for all the forms in
my application. This works great to get the messages but I have
discovered some problems when I want to use it on all the forms.
I start my application by using ApplicationEx.Run to display my main
form. I call ApplicationEx.AddMessageFilter to add my form and register
a function to recieve the messages for this form. When I push a button
on the main form it will display a second form by using
ApplicationEx.ShowDialog and I will also register this form to recieve
messages. So far everything is great. I will recive the messages in the
second form too. But when I close the second form the application will
throw two ObjectDisposedExceptions.
I have tried to solve this by setting the disposeForm parameter to false
when calling ShowDialog and this works but the form is then not closed,
only hidden behind the main form. And when I close the second form from
the main form I still get the ObjectDisposedExceptions.
I have also tried to remove the messagefilter in the main form before
calling ShowDialog without success. I have DialogResult set before
closing the second form.
Any solution to this?
Sincerely
Linus Rörstad