Introduction
This is very handy keyboard shortcut which started with the need to mark and select a word inside the IDE of VC6 without having to take my hand from the keyboard and use the mouse. In order to do that with the standard IDE commands of VC6 IDE one needs to use a couple of keyboard shortcuts. For example, when the cursor is in the middle of a word one has to press Ctrl + left arrow to go to the beginning of the word and then press Shift+Ctrl and right arrow to select the word, or double click the word with the mouse.
The following is a macro that does the above. I personally assigned it on the Ctrl+= shortcut because it was available.
Here is the code:
Sub doubleclick()
'DESCRIPTION: For simulated double clicking
'Begin Recording
ActiveDocument.Selection.WordLeft
ActiveDocument.Selection.WordRight dsExtend
'End Recording
End Sub
All you have to do is copy the above routine inside your macro file and assign a keyboard shortcut for it.
For those who don't know how to do that follow these instructions:
- Open VC6. Go to the "Tools" menu, select "Macro".
- Copy the above code.
- On the dialog box that appears on the screen press "Edit".
- Enter the name of the macro (in this case doubleclick) and the description "For simulated double clicking".
- A file will open and the cursor will be right under the
DESCRIPTION
part of the function. Select the whole function and paste over it the above code.
- When you finish save the file and close it.
To assign a keyboard shortcut select again the "Macro" option from the "Tools" menu. Select the "doubleclick" macro, press the "Options>>" button and then the "Keystrokes" button. On the dialog box that appears select the "doubleclick" macro and put the cursor on the "Press new shortcut key" field. Press the desired shortcut key (Ctrl + = worked for me).
If the shortcut you pressed is already assigned then under the field you get a message. In that case delete whatever you pressed and try a new shortcut. You won't believe how many keyboard shortcuts are already assigned for the IDE.
If the shortcut is not assigned then press close and you are ready.
Enjoy programming!!!