RT。
改程序在一般情况下不会死,但一旦最小化,就再也不能还原。
改程序代码
Form1:Option Explicit
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" (iccex As tagInitCommonControlsEx) As Boolean
Private Type tagInitCommonControlsEx
 lngSize As Long
 lngICC As Long
End Type
Private m_hMod As Long
Private m_hMod2 As Long
Private Const ICC_USEREX_CLASSES = &H200
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Sub Form_Load()
Load Form2
Form2.Show
WebBrowser1.Navigate "http://www.qiyi.com/dongman/xyyyhtl.html"
WebBrowser1.Silent = True
End SubPrivate Sub Form_Resize()
If Form1.WindowState = 1 Then
WebBrowser1.Width = 0
WebBrowser1.Height = 0
Else
WebBrowser1.Width = Form1.Width - 100
WebBrowser1.Height = Form1.Height - 500
End If
End SubPrivate Sub Form_Unload(Cancel As Integer)
Unload Form2
End SubPrivate Sub Form_Initialize()
Dim iccex As tagInitCommonControlsEx
    iccex.lngSize = LenB(iccex)
    iccex.lngICC = ICC_USEREX_CLASSES
    InitCommonControlsEx iccex
   
    m_hMod = LoadLibrary("shell32.dll")
    m_hMod2 = LoadLibrary("explorer.exe")
 Call InitCommonControlsVB
End SubPublic Function InitCommonControlsVB() As Boolean
 On Error Resume Next
 Dim iccex As tagInitCommonControlsEx
 With iccex
 .lngSize = LenB(iccex)
 .lngICC = ICC_USEREX_CLASSES
 End With
 InitCommonControlsEx iccex
 InitCommonControlsVB = (Err.Number = 0)
 On Error GoTo 0
End Function
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Form2.Text1.Text = Text
End SubPrivate Sub WebBrowser1_TitleChange(ByVal Text As String)
Form1.Caption = WebBrowser1.LocationName & " - 观看器"
End SubPrivate Sub WebBrowser1_WindowClosing(ByVal IsChildWindow As Boolean, Cancel As Boolean)
Unload Form1
End Sub
Private Sub Form_Terminate()
    If m_hMod Then FreeLibrary m_hMod
    If m_hMod2 Then FreeLibrary m_hMod2
End Sub
form2:Private Sub Command1_Click()
Form1.WebBrowser1.Navigate "http://tieba.baidu.com/喜羊羊与灰太狼"
End SubPrivate Sub Command2_Click()
Form1.WebBrowser1.Navigate "http://tieba.baidu.com/沸喜"
End SubPrivate Sub Command3_Click()
Form1.WebBrowser1.Navigate Command
End SubPrivate Sub Form_Load()
Text1.Locked = True
SetWindowPos Form2.hwnd, HWND_TOPMOST, 0, 0, 0, 0, Flag
End SubPrivate Sub Form_Unload(Cancel As Integer)
Unload Form1
End Sub

解决方案 »

  1.   

    还有一个模块。Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As LongPublic Const SWP_NOMOVE = &H2 '不移动窗体Public Const SWP_NOSIZE = &H1 '不改变窗体尺寸Public Const Flag = SWP_NOMOVE Or SWP_NOSIZEPublic Const HWND_TOPMOST = -1 '窗体总在最前面Public Const HWND_NOTOPMOST = -2 '窗体不在最前面
      

  2.   

    改用xmlhttp吧,WebBrowser1功能不全
      

  3.   


    xmlhttp是一个对象。用来POST GET的
    我是要做个浏览器。