Hi,
I am trying to learn how to manipulate other opened windows from a VB.NET program. In this case I want to change the title of a particular IE window when/if it opens. That is a hotmail sign in account.
The code works fine up to finding the correct window and I see it remove the title "Sign In - Microsoft Internet Explorer" but it just leaves it blank?
Am I declaring something wrong . I mean HELP!!!
VB Code:
Public Class Form1 Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = 1000 Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim name As String = "IEFrame" Dim title As String = "Sign In - Microsoft Internet Explorer" Dim handleofwindow As Long = FindWindow(name, title) If handleofwindow <> 0 Then SetWindowText(handleofwindow, "What are you doing?") End If End Sub End Class




Reply With Quote