AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Übersetzung C++ -> Delphi Probleme
Thema durchsuchen
Ansicht
Themen-Optionen

Übersetzung C++ -> Delphi Probleme

Ein Thema von sieppl · begonnen am 12. Nov 2004 · letzter Beitrag vom 12. Nov 2004
Antwort Antwort
Benutzerbild von sieppl
sieppl

Registriert seit: 15. Aug 2004
Ort: Münster
198 Beiträge
 
Delphi 7 Professional
 
#1

Übersetzung C++ -> Delphi Probleme

  Alt 12. Nov 2004, 11:57
Hallo!

Ich versuche Funktionen der _ISource30.dll zu wrappen.
ImageSource Webpage

Hier sind Auszüge aus dem C++ Header:

Code:
_IS3EXP_   BOOL IS3CALL _IS3GetJPGDimsEx(HISSRC hSource, UINT32 *puWidth, UINT32 *puHeight, UINT32 *puBitDepth, UINT32 *puColorSpace, ISDPIStruct *pDPIStruct);

// structure used to set DPI to files
#ifndef IS_DPI_STRUCT_DEF
#define IS_DPI_STRUCT_DEF
typedef struct ISDPIStruct_t
{
   UINT32 uDPIX;
   UINT32 uDPIY;
   UINT32 uDPIUnits;
} ISDPIStruct;
#endif
Hier ein bisschen Delphi-Code:
Delphi-Quellcode:
implementation

type
  TDpiStruct = packed record
   DPiX: DWORD;
   DPiY: DWORD;
   DPIUnits: DWORD;
  end;

  PDpiStruct = ^TDpiStruct;

function IS3GetJPGDims(Source: THandle; Width, Height, BitDepth, ColorSpace: DWORD; DpiStruct:PDpiStruct): Bool; stdcall;
..

interface
..
function IS3GetJPGDims; external IS3Dll name '_IS3GetJPGDims';


function ISJPGCMYK(const Filename: string): Boolean;
var
  Width, Height, BitDepth, ColorSpace: DWORD;
  DpiStruct: TDpiStruct;
  Handle: THandle;
  Error: DWord;
begin
  IS3Initialize(PChar('{key}'));
  Result := False;
  FillMemory(@DpiStruct, Sizeof(DpiStruct), 0);
  try
    Handle := IS3OpenFileSource(PAnsiChar(Filename));
    if Handle = 0 then
    begin
      Error := IS3GetLastError;
      Result := Boolean(Error);
      Exit;
    end;
    IS3GetJPGDims(Handle, Width, Height, BitDepth, ColorSpace, @DpiStruct); //Hier knallt es.
  finally
    IS3CloseSource(Handle);
  end;
end;
Den Handle bekomme ich ohne Probleme. Wenn ich nun 'IS3GetJPGDims' in 'ISJPGCMYK' aufrufe knallt es. Ich denke es liegt an den Typen.
Es sind meine ersten Versuche eine dll zu übersetzen, wäre cool wenn ich Starthilfe bekomme.

Grüße

Sebastian

btw: _ISource30.dll ist eine sehr mächtige Sammlung von Tools zur Bildbearbeitung. Für 50 Euro wird dann auch das fette Kreuz aus den Bildern entfernt, wenn man nicht registriert ist.

[edit:]
äh, ja pointer sollte man nicht ohne sie allozieren in eine funktion geben.
Ich habe 'Width, Height, BitDepth, ColorSpace' jetzt mal mit '0' initialisiert.
Es knallt nicht mehr, aber Ergebnisse bekomme ich nicht zurück.
Sebastian
  Mit Zitat antworten Zitat
Benutzerbild von jim_raynor
jim_raynor

Registriert seit: 17. Okt 2004
Ort: Berlin
1.251 Beiträge
 
Delphi 5 Standard
 
#2

Re: Übersetzung C++ -> Delphi Probleme

  Alt 12. Nov 2004, 12:14
Das * bei Parametern

_IS3EXP_ BOOL IS3CALL _IS3GetJPGDimsEx(HISSRC hSource, UINT32 *puWidth, UINT32 *puHeight, UINT32 *puBitDepth, UINT32 *puColorSpace, ISDPIStruct *pDPIStruct);

das diese Parameter als var oder mittels Pointern übergeben werden müssen.

function IS3GetJPGDims(Source: THandle; var Width, Height, BitDepth, ColorSpace: DWORD; DpiStructDpiStruct): Bool; stdcall;

DPIStruct ist richtig, da es ja als Pointer übergeben wird.

Keine Garantie für irgendwas
Christian Reich
Schaut euch mein X-COM Remake X-Force: Fight For Destiny ( http://www.xforce-online.de ) an.
  Mit Zitat antworten Zitat
Benutzerbild von sieppl
sieppl

Registriert seit: 15. Aug 2004
Ort: Münster
198 Beiträge
 
Delphi 7 Professional
 
#3

Re: Übersetzung C++ -> Delphi Probleme

  Alt 12. Nov 2004, 12:31
bingo! danke!

btw: cooles spiel. freue mich schon auf die final version..
Sebastian
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:12 Uhr.
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