![]() |
AW: Array of Integer und crash
Zitat:
Es geht um GDIPlus alleine die Header sind schon ein paar Hundert Zeilen. gruss |
AW: Array of Integer und crash
Zitat:
|
AW: Array of Integer und crash
Zitat:
Mein Header lädt die GDIPlus dynamisch und alle Funktionen basieren auf WinAPI32 nicht auf Classen. Hmm... ist wieder so ein Problem wo ich mit einem Beispiel leider nicht dienen kann auch wenn ich es wollte. Danke. gruss |
AW: Array of Integer und crash
Zitat:
Versuche damit ein Beispielprogramm mit Initialisierung, Bild laden und das Abfragen der von dir gewünschten Funktion zu bauen. |
AW: Array of Integer und crash
Zitat:
Ansonsten macht es keinen sinn. Sorry nein kein Beispiel. gruss |
AW: Array of Integer und crash
Ggf. sind aber deine Header nicht richtig übersetzt?
Das wäre doch genau der springende Punkt. Wenn das Beispielprojekt mit den mitgelieferten Headern geht und mit deinen nicht, dann weißt du doch wo der Fehler ist. |
AW: Array of Integer und crash
Zitat:
Der einzige unterschied ist ich verwende LONG_PTR anstelle von Pointer für die Images. Meine..
Delphi-Quellcode:
Winapi.GDIPAPI
GdipImageGetFrameCount: function(Image: LONG_PTR; dimensionID: PGUID; var count: UINT): GPSTATUS; stdcall;
GdipGetPropertyItem: function(Image: LONG_PTR; propId: PROPID; propSize: UINT; var buffer: PPROPERTYITEM): GPSTATUS; stdcall; GdipGetPropertyItemSize: function(Image: LONG_PTR; propId: PROPID; var size: UINT): GPSTATUS; stdcall; GdipGetPropertyCount: function(Image: LONG_PTR; var numOfProperty: UINT): GPSTATUS; stdcall; GdipGetPropertyIdList: function(Image: LONG_PTR; numOfProperty: UINT; var list: PPROPID): GPSTATUS; stdcall;
Delphi-Quellcode:
function GdipImageGetFrameCount(image: GPIMAGE; dimensionID: PGUID;
var count: UINT): GPSTATUS; stdcall; {$EXTERNALSYM GdipImageGetFrameCount} function GdipGetPropertyItem(image: GPIMAGE; propId: PROPID; propSize: UINT; buffer: PPROPERTYITEM): GPSTATUS; stdcall; {$EXTERNALSYM GdipGetPropertyItem} function GdipGetPropertyItemSize(image: GPIMAGE; propId: PROPID; var size: UINT): GPSTATUS; stdcall; {$EXTERNALSYM GdipGetPropertyItemSize} function GdipGetPropertyCount(image: GPIMAGE; var numOfProperty: UINT): GPSTATUS; stdcall; {$EXTERNALSYM GdipGetPropertyCount} function GdipGetPropertyIdList(image: GPIMAGE; numOfProperty: UINT; list: PPROPID): GPSTATUS; stdcall; {$EXTERNALSYM GdipGetPropertyIdList} hmmm.. sehe gerade hier ist kein var. var buffer: PPROPERTYITEM bei GdipGetPropertyItem (Winapi.GDIPAPI) muss das mal testen. Zitat:
Was gibt er also zurück bei der Winapi.GDIPAPI bei der Funktion GdipGetPropertyItem? NICHTS! Hier ist auch ein Fehler GdipGetPropertyIdList keine Rückgabe, sollte eigentlich den Zeiger auf das Array der Liste zurückgeben. Sorry aber mit so was kann man nicht arbeiten. gruss |
AW: Array of Integer und crash
Code:
Auch hier BYREF = var in Delphi!
DECLARE FUNCTION GdipGetPropertyIdList ( _
BYVAL pImage AS DWORD, _ BYVAL numOfProperty AS DWORD, _ BYREF list AS DWORD _ ) AS LONG list [out] Pointer to an array that receives the property identifiers. DECLARE FUNCTION GdipGetPropertyItem ( _ BYVAL pImage AS DWORD, _ BYVAL propId AS DWORD, _ BYVAL propSize AS DWORD, _ BYREF buffer AS PropertyItem _ ) AS LONG buffer [out] Pointer to a PropertyItem structure that receives the property item. verstehe wer will. gruss |
AW: Array of Integer und crash
Ok ist erledigt Danke.
Es scheint wohl kein Fehler in der Winapi.GDIPAPI vorzuliegen. Habe mal meine beiden Versionen 32 und 64 Bit gegengeprüft. Bei 32 Bit ohne "var" stürzt die Anwendung ab. (D2010) Bei 64 Bit mit "var" genauso. (DX) ---------------------------------------------- Bei 32 Bit mit var funktioniert alles. (D2010) Bei 64 Bit ohne var auch. (DX) Unverständlich warum es hier unterschiede gibt. gruss |
AW: Array of Integer und crash
Liste der Anhänge anzeigen (Anzahl: 1)
Zitat:
Anbei ein Testprojekt als ZIP-Archiv und Quelltext, mit dem du nachvollziehen kannst, wie es in 32- und 64-Bit funktioniert.
Delphi-Quellcode:
unit Unit4;
interface uses Winapi.Windows, System.SysUtils, System.Classes, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtDlgs; type TForm4 = class(TForm) Memo1: TMemo; OpenPictureDialog1: TOpenPictureDialog; procedure Memo1Click(Sender: TObject); private procedure ShowExifInfos(const AFileName: string); procedure LogToMemo(AText: string); end; var Form4: TForm4; implementation uses Winapi.ActiveX, Winapi.GDIPAPI, Winapi.GDIPOBJ, Winapi.GDIPUTIL; {$R *.dfm} procedure GetExifInfo(const AFileName: string; const CommonExifProperties: TArray<PROPID>; const ALogCallback: TProc<string>); var Image: TGPBitmap; PropSize: UINT; PropItemPtr: PPropertyItem; MyPropID: PROPID; MyStatus: Status; LogMsg: string; begin Image := TGPBitmap.Create(AFileName); try if (Image.GetWidth <> 0) and (Image.GetHeight <> 0) then begin for MyPropID in CommonExifProperties do begin PropSize := Image.GetPropertyItemSize(MyPropID); if PropSize > 0 then begin GetMem(PropItemPtr, PropSize); try MyStatus := Image.GetPropertyItem(MyPropID, PropSize, PropItemPtr); if MyStatus = Status.Ok then begin LogMsg := 'Exif-Property: ' + GetMetaDataIDString(PropItemPtr.id) + ' with PropSize: ' + PropItemPtr.length.ToString + ' and data type: ' + ValueTypeFromULONG(PropItemPtr.type_); if Assigned(ALogCallback) then begin ALogCallback(LogMsg) end; end; finally FreeMem(PropItemPtr, PropSize); end; end; end; end; finally Image.Free; end; end; procedure TForm4.LogToMemo(AText: string); begin Memo1.Lines.Add(AText); end; procedure TForm4.Memo1Click(Sender: TObject); var MyFileName: string; begin OpenPictureDialog1.Filter := '*.jpg; *.jpeg'; if OpenPictureDialog1.Execute(Self.Handle) then begin MyFileName := OpenPictureDialog1.FileName; LogToMemo('Öffne Datei ' + MyFileName + sLineBreak); ShowExifInfos(MyFileName); LogToMemo(sLineBreak + 'Fertig!'); end; end; procedure TForm4.ShowExifInfos(const AFileName: string); var CommonExifProperties: TArray<PROPID>; begin CommonExifProperties := [ PropertyTagExifAperture , PropertyTagExifBrightness , PropertyTagExifCfaPattern , PropertyTagExifColorSpace , PropertyTagExifCompBPP , PropertyTagExifCompConfig , PropertyTagExifDTDigitized , PropertyTagExifDTDigSS , PropertyTagExifDTOrig , PropertyTagExifDTOrigSS , PropertyTagExifDTSubsec , PropertyTagExifExposureBias , PropertyTagExifExposureIndex , PropertyTagExifExposureProg , PropertyTagExifExposureTime , PropertyTagExifFileSource , PropertyTagExifFlash , PropertyTagExifFlashEnergy , PropertyTagExifFNumber , PropertyTagExifFocalLength , PropertyTagExifFocalResUnit , PropertyTagExifFocalXRes , PropertyTagExifFocalYRes , PropertyTagExifFPXVer , PropertyTagExifInterop , PropertyTagExifISOSpeed , PropertyTagExifLightSource , PropertyTagExifMakerNote , PropertyTagExifMaxAperture , PropertyTagExifMeteringMode , PropertyTagExifOECF , PropertyTagExifPixXDim , PropertyTagExifPixYDim , PropertyTagExifRelatedWav , PropertyTagExifSceneType , PropertyTagExifSensingMethod , PropertyTagExifShutterSpeed , PropertyTagExifSpatialFR , PropertyTagExifSpectralSense , PropertyTagExifSubjectDist , PropertyTagExifSubjectLoc , PropertyTagExifUserComment , PropertyTagExifVer ]; GetExifInfo(AFileName, CommonExifProperties, LogToMemo); end; end. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:18 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