|
-
Jul 25th, 2008, 05:23 PM
#1
Thread Starter
PowerPoster
Clear Emmediate Window
I doubt this, but Is there a command to clear the Emmediate Window?
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 25th, 2008, 05:50 PM
#2
Re: Clear Emmediate Window
i have seen some Add Ins to do this
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 25th, 2008, 05:51 PM
#3
-
Jul 25th, 2008, 06:28 PM
#4
Thread Starter
PowerPoster
Re: Clear Emmediate Window
Thanks guys but I should have been more specific, as I want to do this in code. Will MZTools provide me with that?
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 25th, 2008, 08:11 PM
#5
Re: Clear Emmediate Window
No, it's not possible while the program is running. If you think about that it makes sense because the Immediate window is a part of the IDE.
-
Jul 25th, 2008, 09:27 PM
#6
Thread Starter
PowerPoster
Re: Clear Emmediate Window
 Originally Posted by MartinLiss
No, it's not possible while the program is running. If you think about that it makes sense because the Immediate window is a part of the IDE.
Yeah, I figured as much but I had to ask.
Thanks Martin.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 25th, 2008, 09:32 PM
#7
Thread Starter
PowerPoster
Re: Clear Emmediate Window
 Originally Posted by gavio
Many add-ins like MZ-Tools can do it  (it's even free for VB6)  yey!
If there are any members using MZTOOLS I would like to hear what they think of it.
Thanks.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 25th, 2008, 09:37 PM
#8
Re: Clear Emmediate Window
I think the immediate window only holds 255 lines at a time, so if you Debug.Print 255 times anything before it is wiped out.
Dim i As Integer
Debug.Print "hello world"
For i = 1 To 255
Debug.Print
Next i
-
Jul 25th, 2008, 10:19 PM
#9
Thread Starter
PowerPoster
Re: Clear Emmediate Window
 Originally Posted by Edgemeal
I think the immediate window only holds 255 lines at a time, so if you Debug.Print 255 times anything before it is wiped out
Thanks for the tip. I discovered the 255 limit last week while debugging a loop.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 25th, 2008, 11:25 PM
#10
Re: Clear Emmediate Window
FYI I have two things that may help with debugging, one is a tutorial I wrote on the subject and the other is an add-in that you can use to add the name of all (or a subset) of procedures as a constant that you can use in error handling routines or as part of a debug.print <procedure name> that you can use to supplement what you find in the call stack. You'll find links to both in my signature.
-
Jul 26th, 2008, 12:01 AM
#11
Thread Starter
PowerPoster
Re: Clear Emmediate Window
 Originally Posted by MartinLiss
FYI I have two things that may help find links to both in my signature.
Thanks Martin, I'll check it out.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 26th, 2008, 06:54 AM
#12
Re: Clear Emmediate Window
 Originally Posted by CDRIVE
If there are any members using MZTOOLS I would like to hear what they think of it.
Thanks.
My 1st post already said everything - i can't do anything in VB wihtouth MZ-Tools
-
Jul 26th, 2008, 07:29 AM
#13
Thread Starter
PowerPoster
Re: Clear Emmediate Window
 Originally Posted by gavio
My 1st post already said everything - i can't do anything in VB wihtouth MZ-Tools 
OK, that's clear enough.
Thanks
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 26th, 2008, 08:02 AM
#14
Thread Starter
PowerPoster
Re: Clear Emmediate Window
 Originally Posted by Edgemeal
I think the immediate window only holds 255 lines at a time, so if you Debug.Print 255 times anything before it is wiped out.
Dim i As Integer
Debug.Print "hello world"
For i = 1 To 255
Debug.Print
Next i
BTW, I tried this concept by using Debug.Print VbBack hoping that it would back space over whatever was there but no go.
Code:
Option Explicit
Private Sub Form_Load()
Dim i%
For i% = 1 To 100
Debug.Print i%
Next i%
For i% = 1 To 100
Debug.Print vbBack
Next i%
End Sub
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 26th, 2008, 10:24 PM
#15
Re: Clear Emmediate Window
There is something about the Immediate window that makes it impossible to send messages to it, i'm not sure what it is, maybe the fact that it gets disabled permanently. I've got to the point that.. if you place the cursor at the end of a line, the chars in that line get deleted, but i just can't delete all the lines, even if you add the calls to postmessage inside a for loop, or if CONTROL-A is sent first to select all, no wey to delete everything in just one call, a loop will work just if it's run with F8 (running code line by line), else the messages are not posted or the window gets disabled.
For clearing just 1 line (current line)..
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Const WM_ACTIVATE As Long = &H6
Private Const WM_KEYDOWN As Long = &H100
Private Sub Command1_Click()
Dim lWinVB As Long, lWinEmmediate As Long
lWinVB = FindWindow("wndclass_desked_gsk", vbNullString)
'your Inmediate window caption as last param, depends on languages..
lWinEmmediate = FindWindowEx(lWinVB, ByVal 0&, "VbaWindow", "Inmediate")
PostMessage lWinEmmediate, WM_ACTIVATE, 1, 0&
PostMessage lWinEmmediate, WM_KEYDOWN, vbKeyBack, 0&
End Sub
Last edited by jcis; Jul 26th, 2008 at 10:28 PM.
-
Jul 26th, 2008, 11:14 PM
#16
Thread Starter
PowerPoster
Re: Clear Emmediate Window
jcis, thank you for the code and your experiences with the immediate window. MS really missed the boat when they didn't include:
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jul 26th, 2008, 11:43 PM
#17
Re: Clear Emmediate Window
you can do in vb.net
i was trying before, using postmessage, but it crashed vb every time so not much help
also findwindowex window class is different if immediate window is /in not docked
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 27th, 2008, 12:27 AM
#18
Re: Clear Emmediate Window
Since we can't delete the text in the Immediate window when VB6 is running, why not just pause it for a second , del text, and run again?
Here's a basic (working) idea..
EDIT This only seems to work if the Immediate window is not docked!
Code:
' ModClearImmediate.Bas
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetActiveWindow Lib "user32" (ByVal hwnd As Long) As Long
Public Sub ClearImmediate()
Dim Parnt As Long
Dim Imm As Long
' Get handle to Immediate window
Imm = FindWindow("DockingView", "Immediate")
If Imm Then
Parnt = GetParent(Imm) ' get parent (VB6 IDE)
SetActiveWindow Parnt ' set VB6 IDE as active window
SendKeys "^({BREAK})" ' pause VB6 IDE
SetActiveWindow Imm ' set Immediate window active
SendKeys "^({Home})" ' select all text
SendKeys "^(+({End}))"
SendKeys "{Del}" ' delete
SendKeys "{F5}" ' Run VB6 IDE
End If
End Sub
Last edited by Edgemeal; Jul 27th, 2008 at 12:54 AM.
Reason: Changed to Public Sub/ Module.Bas
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|