Announcement

Collapse
No announcement yet.

Sending Data To The Keyboard

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sending Data To The Keyboard

    Anyone have any info on sending data to the keyboard? I have a USB keyboard
    with another device connected downstream that I wish to send data to. This other
    device appears to the system as a keyboard (uses a std. keyboard controller) but
    actually performs other functions.

    I know that the Caps/Num Lock/Scroll Lock keys can be set, but I'm wondering if
    there's a generic "SendByteToKeyboard"-type function.

    Thanks!

    ------------------
    Mark Newman
    Mark Newman

  • #2
    It sounds like you'll need to communicate through the USB driver, which I would expect the keyboard driver to be doing when it provides support for API's such as SetKeyboardState(), etc.

    It may be worthwhile to wander over to www.lvr.com and check out some of the USB libraries/info they have there.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Thanks Lance! I did check MSDN but it was almost too much info;
      the LVR site seems to have a lot of practical info.



      ------------------
      Mark Newman
      Mark Newman

      Comment


      • #4
        Maybe?

        DECLARE SUB keybd_event LIB "USER32.DLL" ALIAS "keybd_event" (BYVAL bVk AS BYTE, BYVAL bScan AS BYTE, BYVAL dwFlags AS LONG, BYVAL dwExtraInfo AS LONG)
        DECLARE SUB mouse_event LIB "USER32.DLL" ALIAS "mouse_event" (BYVAL dwFlags AS LONG, BYVAL dx AS LONG, BYVAL dy AS LONG, BYVAL cButtons AS LONG, BYVAL dwExtraInfo AS LONG)


        ------------------
        [email protected]
        hellobasic

        Comment


        • #5
          Does keybd_event() and mouse_event() send data to keyboard devices? I thought they placed synthesized keyboard/mouse messages in the system message queue.

          How can they be used to send data to a USB device that looks to be a keyboard?

          Curious...

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            I'm currently using kybd_event() as it's the only one I found that
            can send data to the keyboard, though it's limited to the Caps/Num/etcLock
            items.

            From the hardware docs I have, a single 8-bit structure is sent to the
            keyboard for controlling the XxxxLock items, as well as the Kana &
            Compose locks. But some of the newer "Internet" keyboards have multiple
            special-purpose buttons & lights, so there must be additions to the
            standard 8-bit keyboard command structure.

            I still think that there has to be a "SendByteToKeyboard" function somewhere,
            but it's either undocumented or else implemented in the driver code.



            ------------------
            Mark Newman
            Mark Newman

            Comment


            • #7
              MSDN:

              Remarks

              When keyboard input is disabled with EnableHardwareKeyboard(FALSE), you can simulate keyboard input using keybd_event.



              ------------------
              [email protected]
              hellobasic

              Comment


              • #8
                i use this since a few years...


                ------------------
                -------------------------------------------
                francis beaulieu
                frablaser softwares
                Francis Beaulieu
                Prog senior of 17 years.
                Microsoft Specialist

                Comment

                Working...
                X