Results 1 to 4 of 4

Thread: pressing function keys in DOS via vb6

  1. #1

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Question 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.

  2. #2

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284
    ohh.. heres a solution =>

    (module)
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
    4. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    5.  
    6. Public Enum VirtualKeys
    7. VK_F1 = &H70
    8. VK_F2 = &H71
    9. VK_ENTER = &HD
    10. VK_INSERT = &H2D
    11. VK_ESCAPE = &H1B
    12. VK_END = &H23
    13. End Enum
    14.  
    15. Private Const KEYEVENTF_KEYUP = &H2
    16.  
    17. Public mvarDestination As Long
    18.  
    19. Public Sub SendA_F_Key(ByVal sKeys As VirtualKeys)
    20.  
    21.    Dim nShiftScan    As Integer
    22.    nShiftScan = MapVirtualKey(sKeys, 0)
    23.    AppActivate (mvarDestination)
    24.    keybd_event sKeys, nShiftScan, 0, 0
    25.    keybd_event sKeys, nShiftScan, KEYEVENTF_KEYUP, 0
    26. End Sub

    (call dos app)
    VB Code:
    1. 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...

  3. #3

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Cool

    halo?!

  4. #4

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284
    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
  •  



Click Here to Expand Forum to Full Width