help with activex MIDAS app

hi

is there anyone who can help me with the following problem. we are
developing an activex app that connects via tcpip and midas to an
application server. when we disconnect an user from the app server at the
socket server, it generates a popup 'error reading socket'
does anyone know how to trap this error. what  generates (its in a iexplorer
dialogbox) this error and why?
we want to display a custom error box there to inform the client what has
happened and why.

any help appreciated