Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to manage invalidate between two tvirtualstringtree in same form? 1 129
QRReport  TQrmemo vertical stretching 1 53
Delphi 2 69
Delphi: sending SMS on android platform 1 34
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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