AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Variablen nicht NIL 64Bit

Ein Thema von EWeiss · begonnen am 1. Sep 2018 · letzter Beitrag vom 12. Sep 2018
 
EWeiss
(Gast)

n/a Beiträge
 
#16

AW: Variablen nicht NIL 64Bit

  Alt 1. Sep 2018, 13:57
Dann zeig doch mal ein komplettes Beispiel, wo die falschen Warnungen geworfen werden.

Bei dem was du hier zeigst kann ich aktuell nur ein korrektes Verhalten sehen/nachvollziehen.
Nicht schon wieder mit deinen Beispielen das hatten wir schon, aber gut..

Delphi-Quellcode:
var
  Graphics: LONG_PTR;
  Fam: GpFontFamily;
  TempFont: GpFont;
  rb: TRect;
  xWidth, YHeight: Integer;
  strFormat: GPSTRINGFORMAT;
  boundingBox, layoutRect: TGPRectF;

begin

  result := GenericError;
  strFormat := nil;
  Fam := nil;
  TempFont := nil; ..// hier kommt Warnung unter D2010 in Delphi 10.2.3 nicht. Deshalb war es vorher nicht addiert.
                     // habe es aber jetzt trotzdem addiert und ignoriere die Warnung.
  Graphics := 0;

  try
    GdipCheck(GdipCreateFontFamilyFromName(PWideChar(UseFont), FontCollection, Fam));
    if Assigned(Fam) then
    begin
      GdipCheck(GdipCreateFont(Fam, UseSize, FontStyle, 2, TempFont));
      if Assigned(TempFont) then
      begin
        // 0: Kein Schatten
        // Positiver wert für Schatten Rechts
        // Negativer wert für Schatten links
        // Zeichne den string
        GdipCheck(GdipCreateStringFormat(0, 0, strFormat));
        GdipCheck(GdipCreateFromHDC(DC, Graphics));

        FillChar(boundingBox, SizeOf(boundingBox), 0);
        FillChar(layoutRect, SizeOf(layoutRect), 0);

        GdipCheck(GdipMeasureString(Graphics, PWideChar(UseText), length(UseText), TempFont,
            @layoutRect, strFormat, @boundingBox, nil, nil));

        if Assigned(strFormat) then
          GdipCheck(GdipDeleteStringFormat(strFormat));

        if not WordWrap then
        begin
          xWidth := round(boundingBox.Width + 0.5);
          YHeight := round(boundingBox.Height + 1.5);
          if BlurText then
          begin
            SetRect(rb, rec.Left, rec.Top, rec.Left + xWidth, rec.Top + YHeight);
            BlurTextPlus(DC, UseText, rb, TempFont, BlurColor, 4, UseStrFormat);
          end;
        end else
        begin
          xWidth := rec.Right;
          YHeight := rec.Bottom;
          if BlurText then
          begin
            SetRect(rb, rec.Left, rec.Top, rec.Left + xWidth, rec.Top + YHeight);
            BlurTextPlus(DC, UseText, rb, TempFont, BlurColor, 4, UseStrFormat);
          end;
        end;

        result := DrawStringFormatedEx(Graphics, UseText, rec.Left, rec.Top, xWidth, YHeight,
          ColrARGB, SkinEngine.SK_TEXTRENDERING, TempFont, ShadowOffset, UseStrFormat);
      end;
    end;
  finally
    if Graphics <> 0 then
    begin
      GdipCheck(GdipDeleteGraphics(Graphics));
      Graphics := 0;
    end;

    if Assigned(TempFont) then
    begin
      GdipCheck(GdipDeleteFont(TempFont)); // Und hier kracht es unter Win10 wenn TempFont mit irgendwas gefüllt wird. (In D2010 nicht! )
      TempFont := nil;
    end;

    if Assigned(Fam) then
    begin
      GdipCheck(GdipDeleteFontFamily(Fam));
      Fam := nil;
    end;
  end;

end;

Geändert von EWeiss ( 1. Sep 2018 um 14:00 Uhr)
  Mit Zitat antworten Zitat
 


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 06:32 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 by Thomas Breitkreuz