I know that Ctrl + G shows the debug window.
Is is also possible to close it using the keyboard?
Pradeep :)
Printable View
I know that Ctrl + G shows the debug window.
Is is also possible to close it using the keyboard?
Pradeep :)
Control G shows the Immediate Window for me
Ha ha.. It shows for me too!Quote:
Originally Posted by paralinx
I was looking for some way to close it using the keyboard.
Pradeep :)
With what I know it's not possible to do it. I was wondering if someone could help with some addin that could add this capability to VB6 editor.
Pradeep :)
Forgive my ignorance, why it would be useful? You don't like the mouse? Or maybe the mouse doesn't work? Just curiosity. :)
Like any window use ALT-F4.
If you are writing an add-in you could probably do this but I haven't tried it.Quote:
Originally Posted by Pradeep1210
VB Code:
Public oVBE As VBIDE.VBE oVBE.Windows("Immediate").Close
that will close the entire program..Quote:
Originally Posted by brucevde
Not neccessarily. ALT-F4 closes the active window. If that is the VB IDE main window then yes VB will close.Quote:
that will close the entire program..
I should have said.
CTRL-G
ALT-F4
not for me man,
I'll press control + G, then Alt + F4, and it will give me the "save project" message like your going to exit VB..
Many a times we need to frequently check variable/property values or run some procedure or set some value while debugging thus using the debug window. Ctrl+G comes here handy.Quote:
Originally Posted by jcis
But as soon as that has been done and we want to resume debugging, we need more visible space and we need to close the debug window.
When doing the above thing quite fast, it's a pain in the neck to touch the mouse every now and then.
@brucevde
Alt+F4 closes the entire application, Ctrl+F4 will close the active window in an MDI application.
In VB IDE, it will close the debug window only when it is in window form, i.e. it is NOT docked. I want to close the debug window whether docked or not. (My debug window is usually docked)
@Marty:
When I start a new Addin Program, and run it, it doesn't seem to run. Do we need to do something else also for addin programs. I havn't made any addins yet.
Pradeep
OK got it working!
But how do I trap keys?
(say I want to press Ctrl+Shift+G) to close the debug window.
Pradeep :)
Something like this
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If GetAsyncKeyState(vbKeyG) And GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyControl) Then 'Close Your Debug Window Here End If End Sub Private Sub Form_Load() Me.KeyPreview = True End Sub
Oops!, now I realize that you need it to work with the IDE, not an app, oh well. :(
Actually what I wanted to know is that how will the Shortcut apply to the IDE? How do I code it within the Addin?
Pradeep
I'll make one for you but it will probably be tomorrow before I have time to get to it.
Sorry Pradeep but I'm going to back out on my offer. While I've written a couple of addins (one of which is in the UtilityBank) it's still a lot of work and I guess I'm just not up to it. Let me suggest this book. It's the one I use.
If you want to hook keys in general try this:
http://www.vbaccelerator.com/home/VB...ol/article.asp
You can use the code in the sample project to figure out how to do hooks (properly).
I recently converted this code to a .DLL which means you could add it to your project as a Class Module (and a few modules) instead of as a user control. If you want to do that let me know and I will upload it. Otherwise just take your lead from that code and hook the "Ctrl+Shift+G" command and respond to it as you wish.
OK After a bit of understanding, I made this addin.
To use it, open the project, and compile the dll. Then close the IDE. After this whenever you open any project, you will find an entry in the "Add-ins" menu called "Hide Immideate Window"
The only problem now is how to Assign Shortcut keys. Please help?
Pradeep
Do you know how to remove this addin? its firing errors each time I open a project, and some menus desapeared or change position.
Go to Add-Ins|Add-In Manager and uncheck all Load Behaviors.
Did you see post #17? That lets you do shortcuts. Its not that hard, but there is not VERY simple way of going about it.Quote:
Originally Posted by Pradeep1210
*sigh* I understand how to use it in regular VB applications but I can't spot the way to use it for Addins. :(Quote:
Originally Posted by eyeRmonkey
Pradeep
You can add a menu item to one of the IDE's menus and create a shortcut that way. This is how I added an "Initial Frame Placement" option in the Format menu.
VB Code:
Private Sub IDTExtensibility_OnConnection(ByVal VBInst As Object, ByVal ConnectMode As VBIDE.vbext_ConnectMode, ByVal AddInInst As VBIDE.AddIn, custom() As Variant) On Error GoTo error_handler 'save the vb instance Set VBInstance = VBInst 'this is a good place to set a breakpoint and 'test various addin objects, properties and methods If ConnectMode = vbext_cm_External Then 'Used by the wizard toolbar to start this wizard m_Place.VBIDE = VBInstance Else Set mcbMenuCommandBar = AddToAddInCommandBar("&Initial Frame Placement") 'sink the event Set Me.MenuHandler = VBInst.Events.CommandBarEvents(mcbMenuCommandBar) End If Exit Sub error_handler: MsgBox Err.Description End Sub Function AddToAddInCommandBar(sCaption As String) As Office.CommandBarControl Dim cbMenuCommandBar As Office.CommandBarControl 'command bar object Dim cbMenu As Object On Error GoTo AddToAddInCommandBarErr Set cbMenu = VBInstance.CommandBars("Format") If cbMenu Is Nothing Then 'not available so we fail Exit Function End If 'add it to the command bar Set cbMenuCommandBar = cbMenu.Controls.Add(before:=3) cbMenuCommandBar.BeginGroup = True 'set the caption cbMenuCommandBar.Caption = sCaption Set AddToAddInCommandBar = cbMenuCommandBar Exit Function AddToAddInCommandBarErr: End Function