Announcement

Collapse
No announcement yet.

Wallpaper als JPG

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wallpaper als JPG

    Wie kann man unter XP und D6 ein Wallpaper im JPG-Format festlegen?<BR>
    Folgendes funktioniert leider nicht.

    <PRE>SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(WindowsVerz+'\xxx.<B>jpg</B>'), SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)</PRE>

    wobei es mit <B>bmp</B> ohne weiteres geht.<BR>
    Unter Desktop/Eigenschaften kann man ja ohne weiters JPG-Bilder als Wallpaper einrichten.

    Danke Wally

  • #2
    Windows kann dort einfach keine Jpegs

    Comment


    • #3
      Nicht so ganz richtig.

      Jedoch genügt es für JPG nicht die über die Systemparameter einzubinden und dann eine Nachricht an das System zu senden.

      Vielmehr muss hier der Active-Desktop mit einem COM-Objekt "anprogrammiert" werden. Dann werden auch JPG's angenommen.

      Ein Beispiel habe ich leider nur in C/C++.

      http://home.snafu.de/christian.marquardt/programme.4/4_wallpaper.htm
      Christian

      Comment


      • #4
        <PRE>
        Ist doch ganz einfach !
        Warum nur immer so umständlich ?
        Schon mal an die Registry gedacht ?
        <BR>
        Gruß raven
        </PRE>
        <BR>
        <PRE>
        unit Unit1;
        <P>
        interface
        <P>
        uses
        Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
        Dialogs, StdCtrls;
        <P>
        type
        TForm1 = class(TForm)
        Button1: TButton;
        Label1: TLabel;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        private
        { Private-Deklarationen }
        public
        { Public-Deklarationen }
        end;
        <P>
        var
        Form1: TForm1;
        Ausrichtung:TCombobox;
        <P>
        implementation
        <P>
        {$R *.dfm}
        <P>
        uses registry;
        <P>
        Function Make_Combobox:string;
        begin
        Ausrichtung:=TCombobox.Create(Ausrichtung);
        Ausrichtung.Parent:=Form1;
        Ausrichtung.Left:=15;
        Ausrichtung.Top:=80;
        Ausrichtung.Show;
        Ausrichtung.Items.CommaText:='Zentriert,Nebeneinan der,Gestreckt';
        Ausrichtung.ItemIndex:=0;
        end;
        <P>
        <P>
        Function Get_Wallpaper:TStringList;
        var Reg:TRegistry;
        WallpaperStyle:integer;
        begin
        //HKEY_CURRENT_USER\Control Panel\Desktop
        Get_Wallpaper:=TStringList.Create;
        Reg:=TRegistry.Create;
        Reg.RootKey:=HKEY_CURRENT_USER;
        Reg.OpenKeyReadOnly('Control Panel\Desktop');
        Get_Wallpaper.Add(reg.ReadString('Wallpaper'));
        WallpaperStyle:=strtoint(reg.ReadString('Wallpaper Style'));
        Reg.Free;
        <P>
        Case WallpaperStyle of
        0: Get_Wallpaper.Insert(1,'Zentriert');
        1: Get_Wallpaper.Insert(1,'Nebeneinander');
        2: Get_Wallpaper.Insert(1,'Gestreckt');
        end;
        <P>
        end;
        <P>
        <P>
        Function Set_Wallpaper:string;
        var Reg:TRegistry;
        WallpaperStyle:integer;
        Bild:string;
        begin
        Bild:='Dateiname.xyz';
        WallpaperStyle:=Ausrichtung.ItemIndex;
        <P>
        //HKEY_CURRENT_USER\Control Panel\Desktop
        Reg:=TRegistry.Create;
        Reg.RootKey:=HKEY_CURRENT_USER;
        Reg.OpenKey('Control Panel\Desktop',true);
        reg.WriteString('Wallpaper',Bild);
        reg.WriteString('WallpaperStyle',inttostr(Wallpape rStyle));
        Reg.Free;
        end;
        <P>
        <P>
        procedure TForm1.Button1Click(Sender: TObject);
        begin
        label1.Caption:='Aktuelles Hindergrundbild: '+Get_Wallpaper[0]+#13#10;
        label1.Caption:=label1.Caption+'Ausrichtung: '+Get_Wallpaper[1];
        end;
        <P>
        procedure TForm1.Button2Click(Sender: TObject);
        begin
        Set_Wallpaper;
        label1.Caption:='Aktuelles Hindergrundbild: '+Get_Wallpaper[0]+#13#10;
        label1.Caption:=label1.Caption+'Ausrichtung: '+Get_Wallpaper[1];
        end;
        <P>
        procedure TForm1.FormCreate(Sender: TObject);
        begin
        Button1.Caption:='Lesen';
        Button2.Caption:='Schreiben';
        Label1.Caption:='';
        Make_Combobox;
        label1.Caption:='Aktuelles Hindergrundbild: '+Get_Wallpaper[0]+#13#10;
        label1.Caption:=label1.Caption+'Ausrichtung: '+Get_Wallpaper[1];
        end;
        <P>
        end.
        <P>
        </PRE&gt

        Comment

        Working...
        X