Accueil > > > CHANGEMENT AUTOMATIQUE DE L'IMAGE DE L'ARRIÈRE PLAN LORS DU DÉMARAGE DU WINDOWS
CHANGEMENT AUTOMATIQUE DE L'IMAGE DE L'ARRIÈRE PLAN LORS DU DÉMARAGE DU WINDOWS
Information sur la source
Description
Hello, I am Ameziane Rabie. This program let us make our Desktop background image always change every time when Windows starts. You just specify the directory that contains all your pictures and you will have every day a new background picture set automaticaly.
Source
- program WallPaper;
-
- uses
- SysUtils, FileCtrl, Windows, Registry;
-
- {$R *.RES}
- var
- Directory, FirstFile: String;
- PictureIndex: Integer;
- i: Integer;
- Info: TSearchRec;
- FileFound: Boolean;
- Reg: TRegistry;
-
- begin
- if ParamCount=2 then
- begin
- // Windows executes the program when it starts sending tow parameters
-
- Directory:=ParamStr(1);
- PictureIndex:=StrToInt(ParamStr(2));
- if DirectoryExists(Directory) then
- begin
- i:=0;
- FileFound:=False;
- if FindFirst(Directory + '*.bmp', faArchive, Info)=0 then
- begin
- FirstFile:=info.Name;
-
- // Search of picture file in directory
- repeat
- Inc(i);
- if PictureIndex = i then
- begin
- FileFound:=True;
- SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(Directory+Info.Name), SPIF_UPDATEINIFILE);
- if FindNext(Info) = 0 then Inc(PictureIndex) else PictureIndex:=1;
- end;
- until (FindNext(Info) <> 0) or FileFound;
-
- // Set first picture file existing in directory
- // as Wallpaper if index picture doesn't exist
- if not FileFound then
- begin
- SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(Directory+FirstFile), SPIF_UPDATEINIFILE);
- PictureIndex:=2;
- end;
-
- // Set next picture's index in the Registry Windows
- Reg:=TRegistry.Create;
- try
- Reg.RootKey := HKEY_LOCAL_MACHINE;
- if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run', True) then
- Reg.WriteString('WallPaper', ParamStr(0)+' '+Directory+' '+IntToStr(PictureIndex));
- finally
- Reg.CloseKey;
- Reg.Free;
- end;
- end;
- end;
- end else
- begin
- // User executes the program
-
- // Select directory of user's pictures
- if SelectDirectory('Select Pictures Directory', '', Directory) then
- begin
- if Length(Directory)<>3 then Directory:=Directory+'\';
- Reg:=TRegistry.Create;
- try
- Reg.RootKey := HKEY_LOCAL_MACHINE;
- if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run', True) then
- Reg.WriteString('WallPaper', ParamStr(0)+' '+Directory+' 1');
- finally
- Reg.CloseKey;
- Reg.Free;
- end;
- end;
- end;
- end.
-
program WallPaper;
uses
SysUtils, FileCtrl, Windows, Registry;
{$R *.RES}
var
Directory, FirstFile: String;
PictureIndex: Integer;
i: Integer;
Info: TSearchRec;
FileFound: Boolean;
Reg: TRegistry;
begin
if ParamCount=2 then
begin
// Windows executes the program when it starts sending tow parameters
Directory:=ParamStr(1);
PictureIndex:=StrToInt(ParamStr(2));
if DirectoryExists(Directory) then
begin
i:=0;
FileFound:=False;
if FindFirst(Directory + '*.bmp', faArchive, Info)=0 then
begin
FirstFile:=info.Name;
// Search of picture file in directory
repeat
Inc(i);
if PictureIndex = i then
begin
FileFound:=True;
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(Directory+Info.Name), SPIF_UPDATEINIFILE);
if FindNext(Info) = 0 then Inc(PictureIndex) else PictureIndex:=1;
end;
until (FindNext(Info) <> 0) or FileFound;
// Set first picture file existing in directory
// as Wallpaper if index picture doesn't exist
if not FileFound then
begin
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(Directory+FirstFile), SPIF_UPDATEINIFILE);
PictureIndex:=2;
end;
// Set next picture's index in the Registry Windows
Reg:=TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run', True) then
Reg.WriteString('WallPaper', ParamStr(0)+' '+Directory+' '+IntToStr(PictureIndex));
finally
Reg.CloseKey;
Reg.Free;
end;
end;
end;
end else
begin
// User executes the program
// Select directory of user's pictures
if SelectDirectory('Select Pictures Directory', '', Directory) then
begin
if Length(Directory)<>3 then Directory:=Directory+'\';
Reg:=TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run', True) then
Reg.WriteString('WallPaper', ParamStr(0)+' '+Directory+' 1');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
end;
end.
Conclusion
Compile the source 'WallPaper.dpr' then execute it to select the directory that includes all your Bitmap pictures. Every time when you start Windows you will have new picture on you DeskTop.
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
TECHDAYS PARIS 2010 : SHAREPOINT 2010 POUR LES DéVELOPPEURSTECHDAYS PARIS 2010 : SHAREPOINT 2010 POUR LES DéVELOPPEURS par ROMELARD Fabrice
Animé par: Laurent Cotton Le développement dans SharePoint 2010 passe par plusieurs axes qui seront évoqués dans cette session, mais plus particulièrement les développements simples lié au besoin Business Business Connectivity Services Ce BCS es...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : PLEINIèRE DERNIER JOURTECHDAYS PARIS 2010 : PLEINIèRE DERNIER JOUR par ROMELARD Fabrice
Cette session est la dernière pleinière de ces 3 jours de TechDays Paris 2010. Généralement, cette troisième journée est plus axée sur l'avenir vu par Microsoft. Après un retour sur l'avenir vu par la Science Fiction ou par ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice UNE JOLIE-HORLOGE ET PAS QU'UN PEU !UNE JOLIE-HORLOGE ET PAS QU'UN PEU ! par neodante
Pour les possesseurs d'iPhone, ça y est Bijin Tokei - qui se traduit littéralement en Français par " Jolie Horloge " - est arrivé et GRATUITEMENT s'il vous plaît ! Après la version Tokyo, Hokkaido, night club, racing, Gal, "pour les mademoiselles'", . voi...
Cliquez pour lire la suite de l'article par neodante TECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICESTECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICES par ROMELARD Fabrice
Animé par: Gaetan Bouveret et Julien Chomarat Business Connectivity Services (BCS) est dans SharePoint 2010 la version 2 de Business Data Catalog (BDC dans SharePoint 2007). Il s'agit de la solution permettant de visualiser des données provenan...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE[DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE par orion
Comme de nombreux geek, je suis un grand amateur de série TV et je rate régulièrement des épisodes de mes séries préférés. Une solution s'offre à vous avec ce merveilleux site : Tv Gorge - www.tvgorge.com Moteur de recherche à l'appui, vous pouvez ...
Cliquez pour lire la suite de l'article par orion
Forum
RE : SAVEDIALOGRE : SAVEDIALOG par JulioDelphi
Cliquez pour lire la suite par JulioDelphi
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
Comparez les prix

HTC Hero
Entre 550€ et 550€
|