Listening to Database connection dialog box

Discussion created by gkar68 on Jun 6, 2013
I am developing an ArcGIS extension with .NET and Desktop 10.1
The extension is creating an sde connection file on the fly and connect to the database
When the user use any of the toolbox like (Select tool from the toolbox) and use one of the layers, the dialog box "Database connection" will be popup and ask the user of user name / password.

Is there a way to listen in the extension to those dialog boxes and fill them automatically.
Or is there a way to listen to toolbox usage of the layers and pass the user name / password?