23. november 2001 - 10:28
#2
flot flemming... hvis han bare holder alt+f4 nede lukker han jo også alle andre programmer end IE!
Og hvorfor skulle han få problemer med at komme på internettet, fordi han bruger et visual basic program til at lukke internet explorer??
23. november 2001 - 21:23
#3
\'--------------------------------- Module1 ---------------------------------
Option Explicit
Private Declare Function EnumWindows& Lib \"user32\" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
Private Declare Function GetWindowText Lib \"user32\" Alias \"GetWindowTextA\" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function IsWindowVisible& Lib \"user32\" (ByVal hwnd As Long)
Private Declare Function GetParent& Lib \"user32\" (ByVal hwnd As Long)
Private Declare Function PostMessage Lib \"user32\" Alias \"PostMessageA\" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_CLOSE = &H10
Private Const WM_GETTEXTLENGTH = &HE
Private Const WM_GETTEXT = &HD
Private sPattern As String, hFind As Long
Private VCount As Integer, ICount As Integer
Private Function FindActivateTitle(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim k As Long, sName As String
If IsWindowVisible(hwnd) And GetParent(hwnd) = 0 Then
sName = Space$(128)
k = GetWindowText(hwnd, sName, 128)
If k > 0 Then
sName = Left$(sName, k)
If lParam = 0 Then sName = UCase(sName)
If sName Like sPattern Then
hFind = hwnd
FindActivateTitle = 0
Exit Function
End If
End If
End If
FindActivateTitle = 1
End Function
Function ActivateAppHwnd(sTitle As String, Optional sMatchCase As Boolean = True) As Long
sPattern = sTitle: hFind = 0
If Not sMatchCase Then sPattern = UCase(sPattern)
EnumWindows AddressOf FindActivateTitle, sMatchCase
ActivateAppHwnd = hFind
End Function
Function CloseAppHwnd(ByVal lhWnd As Long)
PostMessage lhWnd, WM_CLOSE, 0&, 0&
End Function
\'--------------------------------- Module1 ---------------------------------
\'--------------------------------- Form1 ---------------------------------
Option Explicit
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
CloseAppHwnd ActivateAppHwnd(\"*Microsoft Internet Explorer\", True)
End Sub
\'--------------------------------- Form1 ---------------------------------