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:
  1. Public Class Form1
  2.  
  3.      Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  4.       Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
  5.    
  6.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.         Timer1.Interval = 1000
  8.         Timer1.Start()
  9.     End Sub
  10.  
  11.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  12.  
  13.         Dim name As String = "IEFrame"
  14.         Dim title As String = "Sign In - Microsoft Internet Explorer"
  15.         Dim handleofwindow As Long = FindWindow(name, title)
  16.         If handleofwindow <> 0 Then
  17.          
  18.             SetWindowText(handleofwindow, "What are you doing?")
  19.  
  20.         End If
  21.        
  22.  
  23.     End Sub
  24.  
  25.  
  26.  
  27. End Class