Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Header Übersetzung -> Delphi (https://www.delphipraxis.net/108301-header-uebersetzung-delphi.html)

Johnny_W 11. Feb 2008 08:12


Header Übersetzung -> Delphi
 
Hallo,

nun versuche ich mich gerade an einer Header Übersetzung und benötige Hilfe dabei.

Delphi-Quellcode:
typedef struct _tag_HIIDC* HIIDC;
....
HIIDC   IIDCAPI   iidc_open( long index );
Wie definiere ich so etwas denn in Delphi?
_tag_HIIDC ist nur in dieser Zeile zu finden.


viele Grüße

Tyrael Y. 11. Feb 2008 08:21

Re: Header Übersetzung -> Delphi
 
Musst noch suchen was HIIDC für ein record sein soll und wo es definiert ist.

Delphi-Quellcode:
type TTag_HIIDC = ^HIIDC;

function IIDC_OPEN(AIndex: Cardinal): HIIDC

Johnny_W 11. Feb 2008 08:47

Re: Header Übersetzung -> Delphi
 
Danke für den Tip, hat mir weitergeholfen ! :-D

Johnny_W 13. Feb 2008 13:33

Re: Header Übersetzung -> Delphi
 
Hallo nochmal,

Eine weitere Frage habe ich

Code:
typedef struct{
   long      total_frame;      
   long      newest_frameindex;   
} IIDC_TRANSFERINFO;
Code:
long   IIDCAPI   iidc_gettransferinfo( long h, IIDC_TRANSFERINFO* info, long infobytes );
Mein Ansatz sieht so aus :

Delphi-Quellcode:
type
  IIDC_TRANSFERINFO = record
    total_frame : LongInt; //Longint da -1 gesetzt werden könnte
    newest_frameindex : LongInt; //Longint da -1 gesetzt werden könnte
  end;

function iidc_gettransferinfo(h: Cardinal;var Info : IIDC_TRANSFERINFO;InfoBytes : Cardinal) : Cardinal;stdcall;

Da die Werte der Struktur nicht so sind wie Sie sein sollten frage ich sicherheitshalber nach, ob das so stimmt...

viele Grüße!

[edit=SirThornberry]delphi-tags durch c-tags ersetzt - Mfg, SirThornberry[/edit]

Tyrael Y. 13. Feb 2008 13:56

Re: Header Übersetzung -> Delphi
 
Die exakte Darstellung des C-Codes wäre folgendes...

Delphi-Quellcode:
type
  IIDC_TRANSFERINFO_P = ^IIDC_TRANSFERINFO;
  IIDC_TRANSFERINFO = record
    total_frame : LongInt; //Longint da -1 gesetzt werden könnte
    newest_frameindex : LongInt; //Longint da -1 gesetzt werden könnte
  end;

function iidc_gettransferinfo(h: Cardinal;Info : IIDC_TRANSFERINFO_P;InfoBytes : Cardinal) : Cardinal;stdcall;
das übergebene ist ein Pointer auf einen Record

Johnny_W 13. Feb 2008 14:01

Re: Header Übersetzung -> Delphi
 
Danke dir Tyrael Y.!

viele Grüße!

Remko 13. Feb 2008 17:56

Re: Header Übersetzung -> Delphi
 
var Info: IIDC_TRANSFERINFO is the same as Info: IIDC_TRANSFERINFO_P.
In Jedi translations we always use var instead of pointer unless nil is a valid value in which case type must be a pointer

Johnny_W 14. Feb 2008 07:52

Re: Header Übersetzung -> Delphi
 
Hallo da bin ich schon wieder....

Code:
typedef   struct
{
    BOOL             StdMode_Flag;
    struct
    {         
        DWORD        Buffer;              
    } Image;

    struct
    {
        WORD         UnitPos;
    } Ext;
} GETIMAGEINFO, *pGETIMAGEINFO;

Wie sieht denn das Delphi Konstrukt dazu aus?
Manchmal ist ein solches Konstrukt auch in einem Union.
Code:
typedef   struct
{
   union
   {
    struct
    {         
        DWORD        Buffer;              
    } Image;

    struct
    {
        WORD         UnitPos;
    } Ext;
   }u;
} GETIMAGEINFO, *pGETIMAGEINFO;

Ich sehe hier den Wald vor lauter Bäumen nicht...Hoffe mir kann jamand helfen.

Viele Grüße!

[edit=SirThornberry]Delphi-Tags durch c-Tags ersetzt - Mfg, SirThornberry[/edit]

Remko 14. Feb 2008 08:07

Re: Header Übersetzung -> Delphi
 
Delphi-Quellcode:
type
  GETIMAGEINFO = record
    StdMode_Flag: Boolean;
    Image: record
      Buffer: Cardinal;
    end;
    Ext: record
      UnitPos: WORD;
    end;
  end;
  TGetImageInfo = GETIMAGEINFO;
  PGetImageInfo = ^GETIMAGEINFO;
/edit: forgot ; after and of image and ext record ;-)

Johnny_W 14. Feb 2008 09:20

Re: Header Übersetzung -> Delphi
 
Thank you Remko the first struct example works!

So much stuff i did not do yet..wohoo.

best regardz


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:31 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz