Einzelnen Beitrag anzeigen

Magickweis

Registriert seit: 23. Jun 2007
5 Beiträge
 
#8

Re: C++ DLL / Konvertierung der Header-Datei nach Delphi

  Alt 1. Jul 2007, 19:40
Ich schon wieder - jaja, mühsam ernährt sich das Eichhörnchen. Ich bitte einen Fachkundigen kurz einen Blick auf folgende Konversionen zu werfen. Ist das so korrekt? Danke!



P.S.: Sollte die Übersetzung der Header-Files gelingen, werde ich selbstverständlich das ganze hier der Allgemeinheit zur Verfügung stellen - könnte ja sein, daß noch jemand seine Canon Powershot mit Delphi ansteuern möchte.

1)

Code:
typedef void      prVoid;
typedef unsigned char   prUInt8;
typedef   char      prInt8;
typedef char      prChar;
#ifndef macintosh
typedef unsigned short   prWChar;
#endif
typedef unsigned short   prUInt16;
typedef short      prInt16;
typedef unsigned long   prUInt32;
typedef long      prInt32;
typedef float      prFloat32;
#ifdef macintosh
typedef UInt64      prUInt64;
#else
typedef unsigned __int64 prUInt64;
#endif
typedef prUInt32   prResponse;
typedef prUInt16   prBoolean;
typedef prUInt32   prTime;
typedef prUInt32   prEventID;
typedef prUInt32   prContext;

#ifdef macintosh
typedef FSSpec      prFSSpec;
#endif

#ifdef macintosh
typedef prUInt32    prHWND;
#else   
typedef HWND      prHWND;
#endif
typedef prUInt32   prHandle;
typedef prUInt32   prObjectHandle;
Delphi-Quellcode:
type
  prUInt8 = Byte;
  prInt8 = Char;
  prChar = Char;
  prWChar = Word;
  prUInt16 = Word;
  prInt16 = SmallInt;
  prUInt32 = LongWord;
  prInt32 = LongInt;
  prFloat32 = Single;
  prUInt64 = UInt64;
  prResponse = prUInt32;
  prBoolean = prUInt16;
  prTime = prUInt32;
  prEventID = prUInt32;
  prContext = prUInt32;
  prHWND = HWND;
  prHandle = prUInt32;
  prObjectHandle = prUInt32;
--------------------------------------------------------

2)

Code:
typedef struct{
   prWChar ModuleName[512];            /* Module name (512 characters)   */
   prWChar Version[32];               /* Version (32 characters) */
}prVerInfo;

typedef struct{
   prUInt32  Entry;                  /* Number of modules included in this structure */
   prVerInfo VerInfo[prANY];             /* Array of file version number information of PS-ReC SDK modules */
}prDllsVerInfo;

typedef struct{
   prWChar          DeviceInternalName[512];   /* Internal devicve name (512 characters) */
   prWChar            ModelName[32];            /* Camera model name (32 characters) */
   prUInt16         Generation;            /* Camera generation number */
   prUInt32        Reserved1;            /* Reserved */
   prUInt32         ModelID;               /* Camera model ID */
   prUInt16        Reserved2;            /* Reserved */
   prPorttype         PortType;               /* Port type 0x01�FWIA / 0x02�FSTI */
   prUInt32        Reserved3;            /* Reserved */
}prDeviceInfoTable;

typedef struct{
   prUInt32   NumList;               /* Number of camera device information included in this structure */
   prDeviceInfoTable DeviceInfo[prANY];   /* Camera device information */
}prDeviceList;

typedef struct{
   prProgressMsg lMessage;               /* Message */
   prProgressSts lStatus;               /* Status */
   prUInt32     lPercentComplete;         /* The uint of this parameter is percent */
   prUInt32     lOffset;               /* Offset */
   prUInt32     lLength;               /* Size */
   prUInt32     lReserved;            /* Reserved */
   prUInt32     lResLength;            /* Reserved */
   prUInt8 *     pbData;               /* Pointer to the buffer in which the transferred data is stored. */
}prProgress;
Delphi-Quellcode:
type
  prVerInfo = packed record
    ModuleName : Array [0..512] of prWChar;
    Version : Array [0..32] of prWChar;
  end;

  prDllsVerInfo = packed record
    Entry : prUInt32;
    VerInfo : Array [0..prANY] of prVerInfo;
  end;

  prDeviceInfoTable = packed record
    DeviceInternalName   : Array [0..512] of prWChar;
    ModelName      : Array [0..32] of prWChar;
    Generation      : prUInt16;
    Reserved1      : prUInt32;
    ModelID      : prUInt32;
    Reserved2      : prUInt16;
    PortType      : prPortType;
    Reserved3      : prUInt32;
  end;

  prDeviceList = packed record
    NumList      : prUInt32;
    DeviceInfo      : Array [0..prANY] of prDeviceInfoTable;
  end;

  prProgress = packed record
    lMessage      : prProgressMsg;
    lStatus      : prProgressSts;
    lPercentComplete   : prUInt32;
    lOffset      : prUInt32;
    lLength      : prUInt32;
    lReserved      : prUInt32;
    lResLength      : prUInt32;
    pbData      : prUInt8;
  end;
--------------------------------------------------------

3)

Code:
#define prSUB_GENERATION_CAMERA(gen)   ((gen&prGENERATION_CAMERA_MASK)>>8)
Delphi-Quellcode:
function prSUB_GENERATION_CAMERA(gen : Integer) : Integer;
begin
  prSUB_GENERATION_CAMERA := ((gen and prGENERATION_CAMERA_MASK) shr 8);
end;
  Mit Zitat antworten Zitat