Solved

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

Posted on 1998-06-10
2
446 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now