|
|
Title | Clear the Debug/Intermediate window programmatically in VB 4 or VB 5 |
Keywords | debug window, immediate window, clear |
Categories | Software Engineering |
|
|
Use the FindWindow and SetFocusAPI functions to find the window and give it focus. Then use SendKeys to send it the right keys to select the text, pause the program, erase the text, and restart the program.
|
|
Public Sub VB4ClearDebug()
Dim parent_hwnd As Long
parent_hwnd = FindWindow(vbNullString, "Debug Window")
If parent_hwnd = 0 Then Exit Sub
SetFocusAPI parent_hwnd
SendKeys "^{HOME}+^{END}{F5}{DEL}{F5}", True
End Sub
Public Sub VB5ClearDebug()
Dim parent_hwnd As Long
parent_hwnd = FindWindow(vbNullString, "Immediate")
If parent_hwnd = 0 Then Exit Sub
SetFocusAPI parent_hwnd
SendKeys "^{HOME}+^{END}^{BREAK}{DEL}{F5}", False
End Sub
Private Sub CmdClearVB4_Click()
VB4ClearDebug
End Sub
Private Sub CmdClearVb5_Click()
VB5ClearDebug
End Sub
|
|
|
|
|
|