home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
hotkey_1
/
hotkey.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1991-07-27
|
6KB
|
90 lines
Form1
HotKey Demo
Form1
FormIcon
FormIcon
Form_Click
CreateHK
VKCode
Mask]
hWndL
MyCode
KillHK(
hHotKey
@ Form_Load
Form_KeyDown
KeyCode
Shift
Form1
HotKey
Form_Unload
Cancel
List1
Addline
HotKey1
HotKey2
ShiftF9g
Shift_F9
Ctrl_T
Ctrl_D
ShiftMask
CtrlMask
AltMask
SCA_F102
VK_F7
UserVK
VK_F9
Shift_F
FormIcon
Picture
Key_F7
KEY_F8Q
Key_F9
Key_F10
WindowState
hotkey.dll
hotkey.dll
These are from CONSTANT.TXTT
These you just make up!F
These are from page 277 of the Programmer's Guideo
These will be the returned "hot key handles"
Form_Load
This is where I create my hotkeys.
The first paramter is the actual KeyCode I want to trapp
These can be found in CONSTANT.TXT
The Second paramter is the Shift mask, modeled after the
one used in the low level keyboard events.
See page 277 of the Programmer's Guide
The third parameter is our window's handle (hWnd property)
Finally, the fourth parameter is the number we wantt
HOTKEY.DLL to send us when out hotkey is recognizedt
The return paramter is the "handle" of the hot key
The only purpose of this number is to pass to KillHK
F7 to Exit
Shift-F9 to Toggle the Icon"
Ctrl-T to Insert the Current Time"
Ctrl=D to Insert the Current Date"
Shift-Ctrl-Alt-F10 for a Surprise!
Hit...
The point is to have focus elsewhere so we shell out
to NotePad
NOTEPAD.EXE"
Form_KeyDown
This is our "hot key" handlerr
It is rare that this event will ever be triggeredd
otherwise because the form has to have focus which
practically never happens. However, whether it does
or not, makes no difference to HOTKEY.DLLL
User wants to exit
Toggle the iconx
Put the time in the app with focus
Put the date in the app with focus
Pop up a silly message
That was a lot of work for nothing, huh?
Whew!"
Form_Unload
If we are well behaved, we need to call KillHK
for every hotkey we created so that they can bee
used by other programs and searching will be
faster