Solved

Translate small pascal to C++/C (D3|DirectX)

Posted on 1998-06-10
2
453 Views
Last Modified: 2010-04-04
Hello guys would you please translate that to C++.
I need these structure to make some directX stuff with C++ Builder.
I did not found them in the directX headers.
Either you translate the thing, or if you know where they are defined
and what I should include in my C++Builder 3 project let me know.

Thanks.

what I do not know especially is the array[0..0] ?

const
  _c_dfDIKeyboard_Objects: array[0..0] of DIOBJECTDATAFORMAT = (
    (  pguid: @GUID_Key;
       dwOfs: 1;
       dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE;
       dwFlags: 0)
  );

  c_dfDIKeyboard: DIDATAFORMAT = (
      dwSize: Sizeof(c_dfDIKeyboard);
      dwObjSize: Sizeof(DIOBJECTDATAFORMAT);
      dwFlags: 0;
      dwDataSize: SizeOf(DIKEYBOARDSTATE);
      dwNumObjs: High(_c_dfDIKeyboard_Objects)+1;
      rgodf: @_c_dfDIKeyboard_Objects);

type
  DIOBJECTDATAFORMAT = record
    pguid: PGUID;
    dwOfs: DWORD;
    dwType: DWORD;
    dwFlags: DWORD;
  end;
  LPDIOBJECTDATAFORMAT = ^DIOBJECTDATAFORMAT;

  DIDATAFORMAT = record
    dwSize: DWORD;
    dwObjSize: DWORD;
    dwFlags: DWORD;
    dwDataSize: DWORD;
    dwNumObjs: DWORD;
    rgodf: LPDIOBJECTDATAFORMAT;
  end;
  LPDIDATAFORMAT = ^DIDATAFORMAT;

GUID_Key: TGUID = (D1:$55728220;D2:$D33C;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  DIDFT_BUTTON     = $0000000C;
  DIDFT_ANYINSTANCE = $00FFFF00;

type
  DIKEYBOARDSTATE = array[0..255] of Byte;
0
Comment
Question by:jeurk
2 Comments
 
LVL 4

Accepted Solution

by:
d003303 earned 50 total points
ID: 1351960
Yo,
here we go:

typedef struct {
    const GUID * pguid;
    DWORD        dwOfs;
    DWORD        dwType;
    DWORD        dwFlags;
} DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT;

typedef struct {
    DWORD dwSize;
    DWORD dwObjSize;
    DWORD dwFlags;
    DWORD dwDataSize;
    DWORD dwNumObjs;
    LPDIOBJECTDATAFORMAT rgodf;
} DIDATAFORMAT, *LPDIDATAFORMAT;

#define DIDFT_BUTTON            0x0000000C
#define DIDFT_ANYINSTANCE      0x00FFFF00

typedef BYTE[255] DIKEYBOARDSTATE;

REFCLSID GUID_Key =
{
      0x55728220, 0xD33C, 0x11CF,
      0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0
};

DIOBJECTDATAFORMAT _c_dfDIKeyboard_Objects[] =
{
      {
            &GUID_Key,
            1,
            DIDFT_BUTTON | DIDFT_ANYINSTANCE,
            0,
      },
};

DIDATAFORMAT c_dfDIKeyboard =
{
      sizeof(DIDATAFORMAT),
      sizeof(DIOBJECTDATAFORMAT),
      0,
      sizeof(DIKEYBOARDSTATE),
      (sizeof(_c_dfDIKeyboard_Objects) / sizeof(_c_dfDIKeyboard_Objects[0])),
      &_c_dfDIKeyboard_Objects
};

Slash/d003303

0
 
LVL 4

Author Comment

by:jeurk
ID: 1351961
Thanks for the answer.
CU in an other thread.
Jeurk
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question