begin process at 2012 02 05 01:00:51
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

API

 > MODIFIER LE WALLPAPER DE MANIÈRE ALÉATOIRE

MODIFIER LE WALLPAPER DE MANIÈRE ALÉATOIRE


 Information sur la source

Note :
9,5 / 10 - par 2 personnes
9,50 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :API Niveau :Débutant Date de création :17/06/2003 Date de mise à jour :17/06/2003 18:09:23 Vu :2 737

Auteur : Wriggles

Ecrire un message privé
Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

 Description

Ce code permet de chager votre fond d'écran.

Pour ce faire, mettez vos images (bmp) dans un même répertoire et nommez les par un numéro(1.bmp,2.bmp...).

Enfin mettez le chemin du répertoire en paramètre de l'exe

Source

  • program The_wall;
  • {$APPTYPE CONSOLE}
  • uses
  • sysutils,windows,registry;
  • var
  • chemin,oldbmp : string;
  • SRF : TSearchRec;
  • nbfic,i : integer;
  • begin
  • nbfic:=0;
  • // Détection du parametre sinon fermeture;
  • if paramcount>0 then
  • begin
  • with tregistry.create do
  • try
  • rootkey:=HKEY_CURRENT_USER;
  • if openkey('\Control Panel\Desktop',false) then
  • oldbmp:=readstring('Wallpaper');
  • finally
  • free;
  • end;
  • chemin:=paramstr(1);
  • writeln('recherche des fichiers');
  • // Recherche des fichiers commencant par un numéro
  • if FindFirst(chemin+'\*.bmp',faAnyFile,SRF)=0 then
  • begin
  • if strtointdef(copy(SRF.name,0,1),-1)<>-1 then
  • Inc(nbfic);
  • while findnext(SRF)=0 do
  • begin
  • if strtointdef(copy(SRF.name,0,1),-1)<>-1 then
  • Inc(nbfic);
  • end;
  • // Fonction aléatoire sur ces fichiers
  • randomize;
  • i:=random(nbfic);
  • // Evite de retouver le même fond d'écran
  • while i=strtoint(copy(oldbmp,length(chemin)+2,1)) do
  • i:=random(nbfic);
  • //Affectation du nouveau fond d'écran
  • writeln('Affectation');
  • chemin:=chemin+'\'+inttostr(i)+'.bmp';
  • SystemParametersInfo(SPI_SETDESKWALLPAPER,0,PChar(chemin),SPIF_UPDATEINIFILE);
  • end;
  • end;
  • end.
program The_wall;
{$APPTYPE CONSOLE}
uses
  sysutils,windows,registry;

var
  chemin,oldbmp : string;
  SRF : TSearchRec;
  nbfic,i : integer;
begin
  nbfic:=0;
  // Détection du parametre sinon fermeture;
  if paramcount>0 then
  begin
     with tregistry.create do
     try
        rootkey:=HKEY_CURRENT_USER;
        if openkey('\Control Panel\Desktop',false) then
           oldbmp:=readstring('Wallpaper');
     finally
        free;
     end;
     chemin:=paramstr(1);
     writeln('recherche des fichiers');
     // Recherche des fichiers commencant par un numéro
     if FindFirst(chemin+'\*.bmp',faAnyFile,SRF)=0 then
     begin
        if strtointdef(copy(SRF.name,0,1),-1)<>-1 then
           Inc(nbfic);
        while findnext(SRF)=0 do
        begin
           if strtointdef(copy(SRF.name,0,1),-1)<>-1 then
              Inc(nbfic);
        end;
     // Fonction aléatoire sur ces fichiers
     randomize;
     i:=random(nbfic);
     // Evite de retouver le même fond d'écran
     while i=strtoint(copy(oldbmp,length(chemin)+2,1)) do
         i:=random(nbfic);
     //Affectation du nouveau fond d'écran
     writeln('Affectation');
     chemin:=chemin+'\'+inttostr(i)+'.bmp';
     SystemParametersInfo(SPI_SETDESKWALLPAPER,0,PChar(chemin),SPIF_UPDATEINIFILE);
     end;
  end;
end.



 Sources de la même categorie

Source avec Zip Source avec une capture KINECT TEST V1 par FFCAST
Source avec Zip DÉCOUPER UNE FENÊTRE par gta126
Source avec Zip TRANSCRIRE UN FICHIER OPEN FINANCIAL EXCHANGE (OFX) EN FICHI... par jeffem
Source avec Zip Source avec une capture MSXML 4.0 VALIDATION XML / XSD par redtux
Source avec Zip FBRENOMMEADOBJET par fbalien

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,640 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales