Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleClear the Debug/Intermediate window programmatically in VB 4 or VB 5
Keywordsdebug window, immediate window, clear
CategoriesSoftware 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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated