Autor Beitrag
patmann2001
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 201

Windows 7 Prof.
Delphi XE2
BeitragVerfasst: Mo 02.09.02 13:04 
Hallo
Ich möchte gerne das Hintergrundbild zur Laufzeit mit einem Programm ändern.
Wie geht das?

cu Patmann
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 02.09.02 14:04 
Welches Hintergrundbild? Das auf dem Desktop oder irgendein Bild in Deiner Anwendung oder ... ?
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Mo 02.09.02 14:16 
Hi,

ich gehe mal davon aus, dass er den Desktophintergrund wechseln will. Wenn ja, dann kannste folgenden Code verwenden.

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    if not SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Pointer(OpenDialog1.FileName), SPIF_SENDWININICHANGE) then
    begin
      ShowMessage('Konnte folgende Datei nicht als Desktop-Hintergrund setzen: '+OpenDialog1.FileName);
    end;
  end;
end;

_________________
Viele Grüße
Jakob
patmann2001 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 201

Windows 7 Prof.
Delphi XE2
BeitragVerfasst: Mo 02.09.02 16:27 
Yo, danke
Das war's

cu Patmann :lol:
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Mo 02.09.02 16:30 
des is gut :mrgreen:

_________________
Viele Grüße
Jakob
patmann2001 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 201

Windows 7 Prof.
Delphi XE2
BeitragVerfasst: Di 03.09.02 15:34 
Etwas geht leider doch nicht. :(
Ich habe Win2000.
Mit dem Befehl:
ausblenden Quelltext
1:
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Pointer(dateiname), SPIF_UPDATEINIFILE)					

ändert Windows wenigstens das Hintergrundbild bei jedem einloggen, doch leider nicht zur Laufzeit.
Nehme ich:
ausblenden Quelltext
1:
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Pointer(dateiname), SPIF_SENDCHANGE)					

oder
ausblenden Quelltext
1:
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Pointer(dateiname), SPIF_SENDWININICHANGE)					

dann passiert gar nichts.
Kann ich irgendwie den Bildschirm repainten oder muss ich irgendetwas anderes tun?

cu Patmann
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Di 03.09.02 15:42 
was? er ändert nur das Hintergrundbild bei jedem einloggen? Also bei mir macht er das einwandfrei und ich habe auch windows 2000. Haste Admin-Rechte? Service-Pack? Oder was anderes?

_________________
Viele Grüße
Jakob
patmann2001 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 201

Windows 7 Prof.
Delphi XE2
BeitragVerfasst: Di 03.09.02 15:43 
Ich bin Admin
Alle Service Packs sind installiert.
K.A. Warum nicht
cu Patmann
P.S. Es kommen auch keine Fehlermeldungen.
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Di 03.09.02 17:15 
also, ich habe jetzt genau den sourcecode, den ich gepostet habe nochmal ausprobiert und es funtzt einwandfrei. Achja, man darf natürlich keine Jpegs auswählen sondern nur *.bmp-s. Sollte man vielleicht erwähnen, wenn du die Meldung aus dem code gekickt hast. aber so funtzt das einwandfrei. Achja, ich senden SPIF_SENDWININICHANGE.

_________________
Viele Grüße
Jakob
patmann2001 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 201

Windows 7 Prof.
Delphi XE2
BeitragVerfasst: Mi 04.09.02 12:38 
Also Egal was ich probiere:
Es klappt nicht.
cu Patmann
patmann2001 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 201

Windows 7 Prof.
Delphi XE2
BeitragVerfasst: Mi 04.09.02 14:30 
ICH HABS :twisted:
Man muss AKTIVE DESKTOP deaktivieren. Dann geht es :mrgreen:
Danke

cu Patmann
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Mi 04.09.02 15:12 
escht? Gut, der ist bei mir sowieso immer deaktiviert. mag den nicht. :mrgreen:

_________________
Viele Grüße
Jakob