|
-
Mar 19th, 2002, 11:14 PM
#1
Thread Starter
Frenzied Member
pressing function keys in DOS via vb6
hi,
http://www.vbcode.com/asp/showsn.asp?theID=469
here you can found a very nice code for sending keys to a DOS app, but i cant figure out how can i send a function key press (eg. F1 or F2..)
i think i have tried a lot of variations (like chr(0) + ";"...etc) but dosn't works..
help me guys if you have any idea!
R,
Jim.
-
Mar 20th, 2002, 11:01 AM
#2
Thread Starter
Frenzied Member
ohh.. heres a solution =>
(module)
VB Code:
Option Explicit
Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Enum VirtualKeys
VK_F1 = &H70
VK_F2 = &H71
VK_ENTER = &HD
VK_INSERT = &H2D
VK_ESCAPE = &H1B
VK_END = &H23
End Enum
Private Const KEYEVENTF_KEYUP = &H2
Public mvarDestination As Long
Public Sub SendA_F_Key(ByVal sKeys As VirtualKeys)
Dim nShiftScan As Integer
nShiftScan = MapVirtualKey(sKeys, 0)
AppActivate (mvarDestination)
keybd_event sKeys, nShiftScan, 0, 0
keybd_event sKeys, nShiftScan, KEYEVENTF_KEYUP, 0
End Sub
(call dos app)
VB Code:
mvarDestination = Shell(AnyApp, vbMaximizedFocus)
via this code i can send a lot of keys like INSERT, F1...etc.etc,
and now, i cant figure out how can i send the key 'ENTER' if the DOS app is in fullscreen mode... (i can only in windowed mode...)
i have tried a lot of variations like the Clipboard Paster code(Sendkey "% ep"), but nothing happened.. 
its tricky...
-
Mar 22nd, 2002, 05:15 PM
#3
Thread Starter
Frenzied Member
halo?!
-
Apr 2nd, 2002, 03:06 PM
#4
Thread Starter
Frenzied Member
Cmon guys, i need a solution! please help me fellows )
Jim.
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
|