SendInput with DirectInput

Discussion in 'Windows Vista Drivers' started by Arik Yavilevich, Sep 11, 2004.

  1. Hello,

    Somebody posted that SendInput works with DirectInput.
    Can somebody confirm or deny this?

    I was trying to simulate key presses with SendInput or with
    keybd_event but couldn't receive them in a DirectInput application.

    Can someone shed some light on this.

    Thanks,
    Arik Yavilevich.
     
    Arik Yavilevich, Sep 11, 2004
    #1
    1. Advertisements

  2. It works for Win 2000 and XP.
    Win9x does not work. There you need a small VxD to access the keyboard
    buffer which is buried deep inside the system.
     
    Robert Marquardt, Sep 12, 2004
    #2
    1. Advertisements

  3. I am using Win 2000 and it doesn't work.
    Can you provide more detail?

    Thanks.
     
    Arik Yavilevich, Sep 12, 2004
    #3
  4. I have a self-written tray application on my desk which works well on
    Win 2000. It uses keybd_event and mouse_event.
     
    Robert Marquardt, Sep 13, 2004
    #4
  5. It seems I am doing the same thing here but it doesn't work and I
    asked somebody else to check it on his XP system and it doesn't work
    there too.

    I have two programs, one is a "server" program that does:
    while(!kbhit())
    {
    Sleep(2000);
    puts("Down");
    keybd_event(VK_LEFT,0,0,NULL);
    Sleep(500);
    puts("Up");
    keybd_event(VK_LEFT,0,KEYEVENTF_KEYUP,NULL);
    }
    and another "client" program that creates a directinput device for the
    keyboard and checks if buttons are down (using GetDeviceState).

    Now the "server" makes okay key presses because it affects "normal"
    windows application. But the key presses don't reach my "client" or an
    another DirectInput game I am using.

    BTW, I am using DirectInput8Create in the client. Maybe the issue is
    the version of direct x?

    Maybe you can send me your program or I will send you mine? Is it okay
    if I contact you using your email? We are getting a little off-topic
    here.

    I really want to figure this out,
    Arik.
     
    Arik Yavilevich, Sep 13, 2004
    #5
  6. Arik Yavilevich

    Ray Trent Guest

    Well, if you're opening a *particular* keyboard in your DirectInput app,
    rather than GUID_SysKeyboard, I doubt that you'll see anything from it.

    Without details it's really hard to judge what the problem might be. How
    about posting the code for the client instead... it's considerably more
    relevant to the question...
     
    Ray Trent, Sep 13, 2004
    #6
  7. For the record:
    Apparently you have to fill in the bScan parameter of keybd_event even
    though the MSDN says "This parameter is not used".

    Sweet programming to you all,
    Arik.
     
    Arik Yavilevich, Sep 13, 2004
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.