创建IE和改变IE的标题

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As Any, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long

Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
Private Const WM_SETTEXT = &HC
Private Const NULLAPI = 0&
Private Const RDW_INVALIDATE = &H1
Private Const RDW_ERASE = &H4

'改变窗体的标题
Private Sub ChangeForm()

   Dim sClassName As String
   Dim mString As String
   Dim buffer As String
   Dim WindowHandle As Long
    Dim TextLength As Long
 
   WindowHandle = 0
   sClassName = ("IEFrame")
   mString = " "
    
  '查找Windows
   WindowHandle = FindWindowEx(WindowHandle, 0, sClassName, vbNullString)
   If WindowHandle <> 0 Then
      TextLength = SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0, 0)
      buffer = String(TextLength, 0)
      Call SendMessageByString(WindowHandle, WM_GETTEXT, TextLength + 1, buffer)
           
        If InStr(buffer, "优快云") > 0 Then
            Call SendMessageByString(WindowHandle, WM_SETTEXT, 0, ByVal mString)
           ' Call RedrawWindow(WindowHandle, ByVal NULLAPI, NULLAPI, RDW_INVALIDATE Or RDW_ERASE)
            WindowHandle = 0
        End If
   End If


End Sub

'窗体加载
Private Sub Form_Load()
      ShowIe
     ' Unload Me
     Me.Timer1.Enabled = True
End Sub

'Timer事件
Private Sub Timer1_Timer()

Call ChangeForm

End Sub

'打开IE
Private Sub ShowIe()

   On Error GoTo Err
    Dim objExplorer As Object
Err:
    Set objExplorer = CreateObject("InternetExplorer.Application")
  
   ' objExplorer.Navigate "https://www.worldtendency.com:8443/EntryExit/"
     objExplorer.Navigate "www.youkuaiyun.com"
    objExplorer.ToolBar = 0
    objExplorer.StatusBar = 0
    objExplorer.Width = 1000
    objExplorer.Height = 800
    objExplorer.Visible = 1
       
End Sub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值