Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: DirectInput creating?!

  1. #11

    DirectInput creating?!

    This one is working correctly:
    [pascal][background=#FFFFFF][normal=#000000][number=#0000FF][string=#0000FF][comment=#248F24][reserved=#000000]
    procedure TForm1.Button1Click(Sender: TObject);
    type
    TKeyBuff = array [0..255] of char;
    var
    KeyBuff : TKeyBuff;
    m_pDInput: IDirectInput8;
    m_pDInputDevice: IDirectInputDevice8;
    InputCoopFlags: DWORD;
    begin
    DirectInput8Create(GetModuleHandle(nil), DIRECTINPUT_VERSION, IID_IDirectInput8, m_pDInput, nil);

    m_pDInput.CreateDevice(GUID_SysKeyboard, m_pDInputDevice, nil);

    m_pDInputDevice.SetDataFormat(c_dfDIKeyboard);

    InputCoopFlags := DISCL_EXCLUSIVE + DISCL_FOREGROUND + DISCL_NOWINKEY;
    m_pDInputDevice.SetCooperativeLevel(Handle, InputCoopFlags);
    m_pDInputDevice.Acquire;

    case m_pDInputDevice.GetDeviceState(sizeof(KeyBuff),@Ke yBuff) of
    DIERR_INVALIDPARAM : MessageBox(Handle,'Invalid Parameters','',MB_OK);
    DIERR_INPUTLOST : MessageBox(Handle,'Input Lost','',MB_OK);
    DIERR_NOTACQUIRED : MessageBox(Handle,'Not Acquired','',MB_OK);
    DIERR_NOTINITIALIZED : MessageBox(Handle,'Not Initialized','',MB_OK);
    Integer(E_PENDING): MessageBox(Handle,'Pending','a',MB_OK );
    end;
    end;[/pascal]
    Look at http://groups.yahoo.com/group/JEDI-D...s/DirectInput/ for available Delphi DirectInput examples.
    There are only 10 types of people in this world; those who understand binary and those who don't.

  2. #12

    DirectInput creating?!

    it seems this one is working apperiantly i've misplaced the @ with a ^
    thanks clootie but yet again i have a problem how do i convert

    ...
    if (diKeys[DIK_ESCAPE] & 0x80) DoSomething();
    ...

  3. #13

    DirectInput creating?!

    Please, look at the link I posted above...
    Where you can, for example, find this code:
    [pascal] for i := 0 to 255 do
    begin
    if (diks[i] and $80) <> 0 then
    begin
    strNewText := strNewText + Format('$%02x ', [i]);
    end;
    end;
    [/pascal]
    There are only 10 types of people in this world; those who understand binary and those who don't.

  4. #14

    DirectInput creating?!

    Clootie i've registered to the groups but the request need to be authorized by the admin or smth like that from the group so i coudnt look at the actual link.
    sorry for the inconvenience.
    and once more thanks for the help

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •