Re: Delphi Conversion of "C" enum



alanglloyd@xxxxxxx wrote:

I am interfacing to a USB commercial hardware device which is accessed
by a COM interface.

The SDK method declaration is ...

HRESULT ISpeechMikeControl.SetLED(
   [in] LONG lDeviceID,
   [in] LONG lIndex,
   [in] enum spmLEDColor LEDColor,
   [in] enum spmLEDState LEDState);

... and ...

enum spmLEDState
{
  spmLEDOff,
  spmLEDBlinkSlow,
  spmLEDBlinkFast,
  spmLEDOn,
  spmAllLEDsOff
};
... similar for spmLED Color.

The Delphi generated type library declares ...

    procedure SetLED(lDeviceID, lIndex: Integer; LEDColor: spmLEDColor;
LEDState: spmLEDState); safecall;

...and ...

  spmLEDColor = TOleEnum;
  spmLEDState = TOleEnum;

However I find that unless I declare the spmLEDState parameter as a
byte, the method call will not work.

I have tried declaring the parameter as TOleEnum (from OLECtrls.pas),
byte, word and integer. Only a declaration as a byte appears to work.

Any comments, explanations or suggestions please. I am using D3.

Alan Lloyd

not sure, but did you try using "[ value ]" the brackets ? and the
value of the enum type with in ?
 some where i remember that.


-- Real Programmers Do things like this. http://webpages.charter.net/jamie_5

.