do u all know how to close a window in VC++???

cos my program is connect to 1 PLC (controller hardware) and if there's no more connection (when i take the plug out) with the machine, they will show a messagebox sayin' "connection timeout error",,, i dun want the program t show that error message,,,,
i tried to catch that exception but couldn't,,,,,,
in debug window, they show "uncaught exception"!!!!!!!

so is there any way to solve this kind of error......?????

or how can i CLOSE any window or message boxes that's gonna pop up other than the main window???.....

pls help......

THANKS ........ =O)