User:AmiDaniel/VP/CSE Source
From Wikipedia, the free encyclopedia
< User:AmiDaniel | VP
VERSION 5.00 Begin VB.Form Form1 Caption = "AutoClose ScriptError" ClientHeight = 3195 ClientLeft = 60 ClientTop = 345 ClientWidth = 4680 LinkTopic = "Form1" ScaleHeight = 3195 ScaleWidth = 4680 StartUpPosition = 3 'Windows Default Begin VB.Timer Timer1 Interval = 100 Left = 3840 Top = 2640 End Begin VB.Label Label1 Caption = $"Form1.frx":0000 BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 2175 Left = 120 TabIndex = 0 Top = 120 Width = 4335 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Const SW_SHOWNORMAL = 1 Const WM_CLOSE = &H10 Const gcClassnameMSWord = "OpusApp" Const gcClassnameMSExcel = "XLMAIN" Const gcClassnameMSIExplorer = "IEFrame" Const gcClassnameMSVBasic = "wndclass_desked_gsk" Const gcClassnameNotePad = "Notepad" Const gcClassnameMyVBApp = "ThunderForm" Private Sub Timer1_Timer() Dim WinWnd As Long, Ret As String, RetVal As Long, lpClassName As String Ret = "Internet Explorer Script Error" WinWnd = FindWindow(vbNullString, Ret) If WinWnd = 0 Then Exit Sub ShowWindow WinWnd, SW_SHOWNORMAL lpClassName = Space(256) RetVal = GetClassName(WinWnd, lpClassName, 256) PostMessage WinWnd, WM_CLOSE, 0&, 0& End Sub