Update - Close Window (partial title)
This will get the hWnd of freaky programs that change class names every time you start it, and then close it. The only thing you need to know is part of the Titlename (Netsc, instead of "Web Page Title" - Netscape). This WILL close Microsoft Internet Explorer (old version wouldn't) now =Þ. Also, I made it so that you don't have to have a form named "Form1" (by using EnumWindows)
AI
AI 요약: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
소스 코드
Function GetCaption(WindowhWnd)
hwndlength% = GetWindowTextLength(WindowhWnd)
hWndTitle$ = String$(hwndlength%, 0)
a% = GetWindowText(WindowhWnd, hWndTitle$, (hwndlength% + 1))
GetCaption = hWndTitle$
End Function
Function CheckAllWindows(ByVal hwnd As Long, lParam As Long) As Boolean
Dim a
a = LCase(GetCaption(hwnd))
If InStr(1, a, LCase(AppTitle)) <> 0 Then
ApphWnd = hwnd
CheckAllWindows = False
Else
CheckAllWindows = True
End If
End Function
Sub KillWin(Title As String)
Dim a
AppTitle = Title
EnumWindows AddressOf CheckAllWindows, 0&
If ApphWnd = 0 Then Exit Sub
a = PostMessage(ApphWnd, WM_CLOSE, 0&, 0&)
End Sub
'-----Use KillWin to close the window. KillWin "Title"
Upload
원본 댓글 (3)
Wayback Machine에서 복구됨