well the application im trying to close is just sitting there. It doesn't have any threads. OMG I JUST FIXED IT! but i haev another problem now! I have the program set so that it doesn't show itself in the taskbar at the bottom. So I guess thats why it wouldn't close. When I have it set to show in the taskbar it works! I really dont want it in the taskbar though, is there any way to get the closemainwindow to work without the taskbar?