![]() |
Übersetzung C++ -> Delphi Probleme
Hallo!
Ich versuche Funktionen der _ISource30.dll zu wrappen. ![]() Hier sind Auszüge aus dem C++ Header:
Code:
Hier ein bisschen Delphi-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
Delphi-Quellcode:
Den Handle bekomme ich ohne Probleme. Wenn ich nun 'IS3GetJPGDims' in 'ISJPGCMYK' aufrufe knallt es. Ich denke es liegt an den Typen.
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; 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:] :oops: ä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. :( |
Re: Übersetzung C++ -> Delphi Probleme
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; DpiStruct:PDpiStruct): Bool; stdcall; DPIStruct ist richtig, da es ja als Pointer übergeben wird. :duck: Keine Garantie für irgendwas ;) |
Re: Übersetzung C++ -> Delphi Probleme
bingo! danke!
btw: cooles spiel. freue mich schon auf die final version.. ;) |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:39 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz