Entwickler-Ecke

Windows API - Spi_SetFontSmoothing funzt net


Thunder - Sa 29.11.03 21:13
Titel: Spi_SetFontSmoothing funzt net
Moin,


Quelltext
1:
2:
SystemParametersInfo(Spi_SetFontSmoothing, Cardinal(True), Nil, 0);
  repaint;


funzt net!!!

ob bei FormCreate ober ButtonClick. Funzt einfach net in meinem Proggi.

Hab da noch n paar andre Sachen drin...TrayIcon, Schutz vor Mehrfachstart, Fensterschatten

woran liegts?? Hab WinXP und bei einme Beispielprogramm vom PC-Magazin funzt es...


Andreas Pfau - Mo 01.12.03 21:14

Hallo,

zeig doch mal den Code der funzt! also nur die Funktion, innerhalb der SystemParametersInfo() aufgerufen wird.


Thunder - Mo 01.12.03 22:21


Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    CheckBox1: TCheckBox;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private-Deklarationen }
    smooth_active: boolean;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  SystemParametersInfo(SPI_GETFONTSMOOTHING, 1, @smooth_active, 0);
  checkbox1.Checked := smooth_active;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  SystemParametersInfo(SPI_SETFONTSMOOTHING, cardinal(smooth_active), nil, 0);
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
var
  b : boolean;
begin
  b :=checkbox1.checked;
  SystemParametersInfo(SPI_SETFONTSMOOTHING, cardinal(b), 0, 0);
  repaint;
end;

end.


PC-Magazin 11/2001

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.


Andreas Pfau - Di 02.12.03 18:05

Hallo,

keine Ahnung, ist im Prinzip identisch. Mir fällt nur noch eins ein: zuvor mal das ganze mit spi_GETfontsmoothing aufrufen - villeicht nutzt Windows das ja als so 'ne Art Initialisierungsroutine...

Oder eine 2. Variante: GENAU so aufrufen, also nicht mir Cardinal(True), sondern mit einer BOOLEAN-Variablen. Villeicht interpretiert der Compiler das minimal anders.


Thunder - Di 02.12.03 18:56

sowas habe ich schon alles probiert...ich probiere weiter