Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2005

Tip: Looking for answers? Try searching our database.

MessageBox bug?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wayne - 11 Feb 2005 21:48 GMT
I posted this in microsoft.public.dotnet.languages.csharp with name of "Bug
in Framework?"

Drop a timer on the form, set it's interval to 1000 and put this in for the
timer event:

timer1.Enabled = false;
MessageBox.Show("TEST");

Run the application and make sure to take focus away from the form/App. I
just select my News reader. Once you do this and the message box displays
the form is selectable.

I know calling MessageBox.Show(this, "TEST") will make it work just fine,
but shouldn't the method work the same in every case?

Signature

Thanks
Wayne Sepega
Jacksonville, Fl

"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

Matt Garven - 14 Feb 2005 01:11 GMT
Hi Wayne,

When MessageBox.Show is called without passing an IWin32Window, it will call
UnsafeNativeMethods.GetActiveWindow which returns a handle to the active
window for the message loop that belongs to that thread.

If your application isn't active, then GetActiveWindow will return null -
this is why your form is selectable even though a messagebox is being
displayed. It's definitely not a bug in the framework, and the fix you've
suggested is exactly what you should be doing.

Hope this helps.

Regards,
Matt Garven

> I posted this in microsoft.public.dotnet.languages.csharp with name of "Bug
> in Framework?"
[quoted text clipped - 11 lines]
> I know calling MessageBox.Show(this, "TEST") will make it work just fine,
> but shouldn't the method work the same in every case?
Wayne - 15 Feb 2005 13:07 GMT
I understand why it works the way it does, I just don't understand why it is
correct. I mean shouldn't the message box really look for the applications
currently active window? or modal each of the currently displayed windows?

I just question the way it is implemented due to the fact that it doesn't
operate the same in all scenarios and something like this should.

> Hi Wayne,
>
[quoted text clipped - 27 lines]
> > I know calling MessageBox.Show(this, "TEST") will make it work just fine,
> > but shouldn't the method work the same in every case?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.