I am building an application which provides managed 2-factor reauthentication in legacy applications. The idea being that there are certain points in an application where a user ought to be challenged for a password or PIN, and the application do this natively.
Naturally I need the authentication dialog to lock onto the destination application, and prevent the user from clicking behind the dialog. Otherwise, there's no point.
I've got the modal dialog worked out, but when I close my application, the application which the dialog is being attached to closes as well.
For example, if I call this function to lock onto "Untitled - Notepad", the dialog correctly prevents the user from editing the new file but when my application exits, Notepad generates its "save on exit" dialog.
I have tried disposing of the dialog once it's no longer required, to no effect.
Can anyone suggest the reason for this?
Function MyMessageBox(ByVal strMessage As String, _
ByVal CoBrandingImage As String, _
ByVal Btns As MessageBoxButtons, _
ByVal parenthwnd As IntPtr) As DialogResult
Dim frmMsgBx As New Form
Dim dlgResponse As DialogResult
Dim lblMsgText As New Label
Dim btnMsgOK As New Button
dlgResponse = frmMsgBx.ShowDialog(GetWindowFromHost(parenthwnd))