469,601 Members | 2,319 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

WinApp: unhandled win32Exception on Application Exit

nev
251 100+
when i click the 'x' box of a form to exit i get the Error creating window handle.

but when i use my file menu exit menuitem which does...

Global.System.Windows.Forms.Application.Exit()

my program closes with no win32exception was unhandled.

what must i do to the 'x' exitbox to exit application successfully?

the 'x' i'm speaking of is the exit button beside the minimize & maximize button on the upper-right corner of a window.
Nov 23 '07 #1
6 2135
Shashi Sadasivan
1,435 Expert 1GB
Hi nev,
Please follow the genral rules (found in the FAQ section)while posting your questions at TSDN, especially on how to Use a Good Thread Title



Are you Overriding or handling the closing event of the form?
- Shashi
Nov 23 '07 #2
nev
251 100+
Hi nev,
Please follow the genral rules (found in the FAQ section)while posting your questions at TSDN, especially on how to Use a Good Thread Title



Are you Overriding or handling the closing event of the form?
- Shashi
oh sorry about that. truth is i didn't find time to read about that in the first place. i'll check it out. anyways...

i tried to place...

Global.System.Windows.Forms.Application.Exit()

in the...
1. form closing event 'didn't did the job
2. handledestroyed 'not either

on top of that, isn't clicking 'x' supposed to perform Global.System.Windows.Forms.Application.Exit()
Nov 23 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
Only if the parent form is closed the Application.Exit is called.
For all other forms they are only closed.

I am not sure if this would cause an issue by putting it in the ormClosing event. Try the form Closed event

If this form is not the parent form then there i sno need to send that command from the closing / closed event
Nov 23 '07 #4
nev
251 100+
thank you. i'll try it.
Nov 23 '07 #5
nev
251 100+
its the mdiparent actually. it doesn't have a form closed/closing event. here's the situation, a childform is open in the mdiparent. i don't encounter this error before and now it happens when i close the mdi using the 'x'. so i was thinking since the code in my menuitem works, i might as well place it in my mdiparent exit event. the problem is the mdiparent has no exit event.
Nov 23 '07 #6
Shashi Sadasivan
1,435 Expert 1GB
what do you mean by the event does not exist?

Only if you create one will it exists.

if your application starts from the MDI Parent, then that form is the main thread.
any other forms opened are contained in seperate threads.

If any of the child forms/threads are closed the main thread is not affected (until you tell so).
if the MDI Parent is closed (which is the main thread) then all child threads / forms are closed along with it.

I do not know why exactly is that piece of code throwing errors, but it isint of much use.

Could you remove those events and try if it still gives any errors
Nov 23 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Professor Frink | last post: by
5 posts views Thread by Dave Stewart | last post: by
reply views Thread by Colmeister | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.