Solved

c++ data type to Delphi

Posted on 2004-09-20
5
245 Views
Last Modified: 2010-04-05
I'm going through a c++ header file converting data types and I am stuck on this one.. Anybody know how to translate this to Delphi?

typedef union RhtFeatureValue_u
{
    ULONG                   Integer;         // integer values (char, short, int, long)
    ULONG                   Enumeration;     // enumerated types
    ULONG                   BitMap;          // bit-mapped values

    UCHAR                   Reserved[16];    // Maximum of 128 bits.
} RHT_FEATURE_VALUE_U, *PRHT_FEATURE_VALUE_U;
0
Comment
Question by:rbohac
[X]
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
  • 3
5 Comments
 
LVL 4

Expert Comment

by:Evarest
ID: 12103983
This should be it (not 100% sure about RHT_FEATURE_VALUE_U)

PRhtFeatureValue = ^TRhtFeatureValue;
TRhtFeatureValue = record
 int: ULONG;
 Enumeration: ULONG;
 Bitmap: ULONG;
 Reserved: array [0..15] of char; // or string[16];
end;

Hope this helps,
Evarest
0
 
LVL 6

Author Comment

by:rbohac
ID: 12104029
Since it's a union type (and not a struct), shouldn't is look something like:

TRhtFeatureValue = record
  case integer of....
0
 
LVL 4

Expert Comment

by:Evarest
ID: 12104087
If i look at the following thread, I didn't think that the case integer of is needed...

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_11378818.html

I don't really know...
Evarest
0
 
LVL 4

Expert Comment

by:Evarest
ID: 12104151
Sorry, my mistake. rbohac gets the points as he correctly stated that the case integer of is needed. See for example:

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20952048.html?query=typedef+union&topics=85

Kind regards,
Evarest
0
 
LVL 6

Accepted Solution

by:
vadim_ti earned 125 total points
ID: 12104274

  RHT_FEATURE_VALUE_U = record
    case Integer of
      0: _Integer:Cardinal;
      1: _Enumeration:Cardinal;
      2: _BitMap:Cardinal;
      3: _Reserved: array [0..15] of Char;
  end;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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