begin process at 2010 02 10 07:47:38
  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 300

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 NEXTGENS -> UNITÉS DE TYPES ÉVOLUÉS NOUVELLE GÉNÉRATION (DE... par f0xi
Source avec Zip Source avec une capture AUTO-COMPLÉTION D'UN CONTRÔLE DE SAISIE par Bacterius
Source avec Zip CARDS GAME SDK 1.0.0.0 par f0xi
Source avec Zip Source avec une capture TRAYICON - VOTRE ICONE DANS LA BARRE DES TACHES par Bacterius
Source avec Zip Source avec une capture WINHIDER _ CACHER UN PROGRAMME DE L'ÉCRAN ET DE LA BARRE DE ... par soldier8514

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
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,328 sec (3)

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