Hi.
I just had the same problem and found a workaround bymyself.
Maybe know you or anyone else could be still interested in.
So,what I did was basically:
Add a module with an API function to setthe found window in foreground:
Module mdlWinAPI
Public Declare Ansi Function SetForegroundWindow Lib "user32.dll" _
Alias "SetForegroundWindow" (ByVal hwnd As IntPtr) As Boolean
End Module
Then, I added a timer to my form, set to 1/4 second - just to look if there's a Window wich has that specific Caption ("Password Richiesta"). You must change that string to your language localization, i.e.: "Required Password".
The code inside the timer is:
Private Sub tmrCheck_Tick(ByVal sender As Object, ByVal e As EventArgs) _
Handles tmrCheck.Tick
Dim hwnd As IntPtr = Window_FindPartialTitle("Password Richiesta")
If hwnd <> IntPtr.Zero Then
tmrCheck.Stop()
SetForegroundWindow(hwnd)
SendKeys.Send(Pwd_VideoPress)
SendKeys.Send("{ENTER}")
End If
End Sub
Which uses the method:
Private Function Window_FindPartialTitle(ByVal partialTitle As String) _
As IntPtr
For Each p As Process In Process.GetProcesses()
If p.MainWindowTitle.IndexOf(partialTitle, 0, StringComparison.CurrentCultureIgnoreCase) > -1 Then
Return p.MainWindowHandle
End If
Next
Return IntPtr.Zero
End Function
The rest of my code doesn't do much: Shows the files inside the zip and Unzips them to a specified folder.
Hope that someone will find this workaround helpful.