請問在VB裡要用什麼方法才能關閉已開啟的IE
全文搜尋吧
http://www.seminar.idv.tw/viewtopic.php?t=109 由於主機不知中毒還是硬體壞掉..倒置無法上線...實在很苦惱..等發年終定買台機器做備援...屆時定會排除此問題...順便把飯粒粘在這 ===關閉所有IE視窗=== Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Sub Main() EnumWindows AddressOf EnumWindowsProc, 0& End Sub Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean Dim RetVal As Long, lpClassName As String lpClassName = Space(256) RetVal = GetClassName(hwnd, lpClassName, 256) If Left$(lpClassName, RetVal) = "IEFrame" Then Debug.Print "hwnd: " & Str$(hwnd) Debug.Print "Classname: " + Left$(lpClassName, RetVal) '關閉視窗 'ShowWindow hwnd, SW_SHOWNORMAL 'PostMessage hwnd, WM_CLOSE, 0&, 0& End If EnumWindowsProc = True 'Call Back End Function