Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

COMPOSANT TDBPVERSIONINFO


Information sur la source

Catégorie :Composants Classé sous : logiciel, programme, informations, build, version Niveau : Débutant Date de création : 21/10/2004 Vu / téléchargé: 4 733 / 263

Note :
7 / 10 - par 1 personne
7,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note


Description

Ce compo donne les infos de la version du logiciel.
ex: 2.1.12.1979
ou en plus propre
ex: Version 2.1 (build 21.1979)
Voyez la source pour mieux comprendre.
 

Source

  • {
  • ################################################################################
  • # DBPVERSIONIFO #
  • ################################################################################
  • # #
  • # VERSION : 1.2 #
  • # FICHIERS : dbpVersionInfo.pas,.dcu,.dcr,.bmp,ReadMe.htm #
  • # AUTEUR : Julio P. (Diabloporc) #
  • # CREATION : 20 Jul 2004 #
  • # MODIFIEE : 27 Jul 2004 #
  • # SITE WEB : http://diabloporc.free.fr #
  • # MAIL : diabloporc@laposte.net #
  • # LEGAL : Free sous Licence GNU/GPL #
  • # INFOS : Retrouvez moi sur www.delphifr.com : "JulioDelphi" #
  • # Lisez le ReadMe.htm ! #
  • # #
  • ################################################################################
  • }
  • unit dbpVersionInfo;
  • interface
  • uses
  • dialogs, windows, forms, Strman, SysUtils, Classes;
  • type
  • TdbpVersionInfo = class(TComponent)
  • private
  • FAbout: string;
  • function GetAbout: string;
  • function GetVersion: string;
  • function GetCN: string;
  • function GetFD: string;
  • function GetLC: string;
  • function GetIN: string;
  • function GetLT: string;
  • function GetOF: string;
  • function GetPN: string;
  • function GetC: string;
  • function GetPV: string;
  • function LectureVersion(index: word;Value: string): string;
  • function GetMajor: string;
  • function GetMinor: string;
  • function GetRelease: string;
  • function GetBuild: string;
  • protected
  • public
  • property Major: string read GetMajor;
  • property Minor: string read GetMinor;
  • property Release: string read GetRelease;
  • property Build: string read GetBuild;
  • property CompanyName: string read GetCN;
  • property FileDescription: string read GetFD;
  • property FileVersion: string read GetVersion;
  • property InternalName: string read GetIN;
  • property LegalCopyright: string read GetLC;
  • property LegalTradeMarks: string read GetLT;
  • property OriginalFileName:string read GetOF;
  • property ProductName: string read GetPN;
  • property ProductVersion: string read GetPV;
  • property Comments: string read GetC;
  • function FileVersionFmt: String;
  • function Lire(Value: String): string;
  • published
  • property About: String read GetAbout write FAbout;
  • end;
  • procedure Register;
  • implementation
  • {$R DBPVERSIONINFO.dcr}
  • // fonction de lecture des infos du fichier (voir aide delphi :p)
  • function TdbpVersionInfo.LectureVersion(index: word;Value: string):String;
  • Var
  • S : String;
  • Taille : DWord;
  • Buffer : PChar;
  • Autre : PChar;
  • VersionL : DWord;
  • FTruc : string[16];
  • Begin
  • Result:='';
  • S := Application.ExeName;
  • Taille := GetFileVersionInfoSize(PChar(S), Taille);
  • If Taille>0
  • Then Try
  • Buffer := AllocMem(Taille);
  • GetFileVersionInfo(PChar(S), 0, Taille, Buffer);
  • case index of
  • 10: FTruc := Value;
  • 0: FTruc := 'FileVersion';
  • 1: FTruc := 'CompanyName';
  • 2: FTruc := 'FileDescription';
  • 3: FTruc := 'InternalName';
  • 4: FTruc := 'LegalCopyright';
  • 5: FTruc := 'LegalTradeMarks';
  • 6: FTruc := 'OriginalFilename';
  • 7: FTruc := 'ProductName';
  • 8: FTruc := 'ProductVersion';
  • 9: FTruc := 'Comments';
  • end;
  • If VerQueryValue(Buffer, PChar(format('\StringFileInfo\040C04E4\%s',[FTruc])), Pointer(Autre), VersionL)
  • Then Result := Autre;
  • Finally
  • FreeMem(Buffer, Taille);
  • End;
  • End;
  • function TdbpVersionInfo.Lire(Value: string): string;
  • begin
  • result := LectureVersion(10,Value);
  • end;
  • function TdbpVersionInfo.GetAbout: string;
  • begin
  • Result := 'v1.2 par Julio P. (Diabloporc)';
  • end;
  • function TdbpVersionInfo.GetVersion: string;
  • begin
  • Result := LectureVersion(0,'');
  • end;
  • function TdbpVersionInfo.GetCN: string;
  • begin
  • Result := LectureVersion(1,'');
  • end;
  • function TdbpVersionInfo.GetFD: string;
  • begin
  • Result := LectureVersion(2,'');
  • end;
  • function TdbpVersionInfo.GetIN: string;
  • begin
  • Result := LectureVersion(3,'');
  • end;
  • function TdbpVersionInfo.GetLC: string;
  • begin
  • Result := LectureVersion(4,'');
  • end;
  • function TdbpVersionInfo.GetLT: string;
  • begin
  • Result := LectureVersion(5,'');
  • end;
  • function TdbpVersionInfo.GetOF: string;
  • begin
  • Result := LectureVersion(6,'');
  • end;
  • function TdbpVersionInfo.GetPN: string;
  • begin
  • Result := LectureVersion(7,'');
  • end;
  • function TdbpVersionInfo.GetPV: string;
  • begin
  • Result := LectureVersion(8,'');
  • end;
  • function TdbpVersionInfo.GetC: string;
  • begin
  • Result := LectureVersion(9,'');
  • end;
  • // petite fonction pour une sortie plus belle et rapide, ex: "Version 2.0 (build 21.12)"
  • function TdbpVersionInfo.FileVersionFmt: string;
  • begin
  • Result := Format('Version %s.%s (build %s.%s)',[GetMajor,GetMinor,GetRelease,GetBuild]);
  • end;
  • function TdbpVersionInfo.GetMajor: string;
  • begin
  • Result := sm.Before('.',LectureVersion(0,''));
  • end;
  • function TdbpVersionInfo.GetMinor: string;
  • begin
  • Result := sm.Between('.','.',LectureVersion(0,''));
  • end;
  • function TdbpVersionInfo.GetRelease: string;
  • begin
  • Result := sm.BetweenRev('.','.',LectureVersion(0,''));
  • end;
  • function TdbpVersionInfo.GetBuild: string;
  • begin
  • Result := sm.AfterRev('.',LectureVersion(0,''));
  • end;
  • procedure Register;
  • begin
  • RegisterComponents('Diabloporc', [TdbpVersionInfo]);
  • end;
  • end.
{
################################################################################
# DBPVERSIONIFO                                                                #
################################################################################
#                                                                              #
# VERSION       : 1.2                                                          #
# FICHIERS      : dbpVersionInfo.pas,.dcu,.dcr,.bmp,ReadMe.htm                 #
# AUTEUR        : Julio P. (Diabloporc)                                        #
# CREATION      : 20 Jul 2004                                                  #
# MODIFIEE      : 27 Jul 2004                                                  #
# SITE WEB      : http://diabloporc.free.fr                                    #
# MAIL          : diabloporc@laposte.net                                       #
# LEGAL         : Free sous Licence GNU/GPL                                    #
# INFOS         : Retrouvez moi sur www.delphifr.com : "JulioDelphi"           #
#                 Lisez le ReadMe.htm !                                        #
#                                                                              #
################################################################################
}
unit dbpVersionInfo;

interface

uses
  dialogs, windows, forms, Strman, SysUtils, Classes;

type
  TdbpVersionInfo = class(TComponent)
  private
    FAbout: string;

    function GetAbout: string;
    function GetVersion: string;
    function GetCN: string;
    function GetFD: string;
    function GetLC: string;
    function GetIN: string;
    function GetLT: string;
    function GetOF: string;
    function GetPN: string;
    function GetC: string;
    function GetPV: string;
    function LectureVersion(index: word;Value: string): string;
    function GetMajor: string;
    function GetMinor: string;
    function GetRelease: string;
    function GetBuild: string;
  protected
  public
    property Major:        string   read GetMajor;
    property Minor:        string   read GetMinor;
    property Release:      string   read GetRelease;
    property Build:        string   read GetBuild;
    property CompanyName:     string   read GetCN;
    property FileDescription: string   read GetFD;
    property FileVersion:     string   read GetVersion;
    property InternalName:    string   read GetIN;
    property LegalCopyright:  string   read GetLC;
    property LegalTradeMarks: string   read GetLT;
    property OriginalFileName:string   read GetOF;
    property ProductName:     string   read GetPN;
    property ProductVersion:  string   read GetPV;
    property Comments:        string   read GetC;
    function FileVersionFmt:      String;
    function Lire(Value: String): string;

  published
    property About:        String   read GetAbout     write FAbout;
  end;

procedure Register;

implementation

{$R DBPVERSIONINFO.dcr}


// fonction de lecture des infos du fichier (voir aide delphi :p)
function TdbpVersionInfo.LectureVersion(index: word;Value: string):String;
Var
  S         : String;
  Taille    : DWord;
  Buffer    : PChar;
  Autre     : PChar;
  VersionL  : DWord;
  FTruc     : string[16];
Begin
  Result:='';
  S := Application.ExeName;
  Taille := GetFileVersionInfoSize(PChar(S), Taille);
  If Taille>0
  Then Try
    Buffer := AllocMem(Taille);
    GetFileVersionInfo(PChar(S), 0, Taille, Buffer);
    case index of
     10: FTruc := Value;
     0: FTruc := 'FileVersion';
     1: FTruc := 'CompanyName';
     2: FTruc := 'FileDescription';
     3: FTruc := 'InternalName';
     4: FTruc := 'LegalCopyright';
     5: FTruc := 'LegalTradeMarks';
     6: FTruc := 'OriginalFilename';
     7: FTruc := 'ProductName';
     8: FTruc := 'ProductVersion';
     9: FTruc := 'Comments';
    end;
    If VerQueryValue(Buffer, PChar(format('\StringFileInfo\040C04E4\%s',[FTruc])), Pointer(Autre), VersionL)
      Then Result := Autre;

  Finally
    FreeMem(Buffer, Taille);
  End;
End;

function TdbpVersionInfo.Lire(Value: string): string;
begin
 result := LectureVersion(10,Value);
end;

function TdbpVersionInfo.GetAbout: string;
begin
 Result := 'v1.2 par Julio P. (Diabloporc)';
end;

function TdbpVersionInfo.GetVersion: string;
begin
 Result := LectureVersion(0,'');
end;

function TdbpVersionInfo.GetCN: string;
begin
 Result := LectureVersion(1,'');
end;

function TdbpVersionInfo.GetFD: string;
begin
 Result := LectureVersion(2,'');
end;

function TdbpVersionInfo.GetIN: string;
begin
 Result := LectureVersion(3,'');
end;

function TdbpVersionInfo.GetLC: string;
begin
 Result := LectureVersion(4,'');
end;

function TdbpVersionInfo.GetLT: string;
begin
 Result := LectureVersion(5,'');
end;

function TdbpVersionInfo.GetOF: string;
begin
 Result := LectureVersion(6,'');
end;

function TdbpVersionInfo.GetPN: string;
begin
 Result := LectureVersion(7,'');
end;

function TdbpVersionInfo.GetPV: string;
begin
 Result := LectureVersion(8,'');
end;

function TdbpVersionInfo.GetC: string;
begin
 Result := LectureVersion(9,'');
end;

// petite fonction pour une sortie plus belle et rapide, ex: "Version 2.0 (build 21.12)"
function TdbpVersionInfo.FileVersionFmt: string;
begin
 Result := Format('Version %s.%s (build %s.%s)',[GetMajor,GetMinor,GetRelease,GetBuild]);
end;

function TdbpVersionInfo.GetMajor: string;
begin
  Result   := sm.Before('.',LectureVersion(0,''));
end;

function TdbpVersionInfo.GetMinor: string;
begin
  Result   := sm.Between('.','.',LectureVersion(0,''));
end;

function TdbpVersionInfo.GetRelease: string;
begin
  Result   := sm.BetweenRev('.','.',LectureVersion(0,''));
end;

function TdbpVersionInfo.GetBuild: string;
begin
  Result   := sm.AfterRev('.',LectureVersion(0,''));
end;

procedure Register;
begin
  RegisterComponents('Diabloporc', [TdbpVersionInfo]);
end;

end.

Conclusion

ps : StrManager est necessaire ! (StrMan.pas)
 

Fichier Zip

Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip

Commentaires et avis

Aucun commentaire pour le moment.

Ajouter un commentaire

Discussions en rapport avec ce code source dans le forum

pb d'execution du programme [ par drew00 ] je travaille actuellement sur une version d'evaluation de delphi.j'ai essayé d'executer mon programme depuis une machine ou le logiciel n'est pas inst Version de démonstration d'un logiciel sous delphi 5 [ par bfouad ] Bonjour,Je désire connaître, s'il y'a une méthode sous delphi, pour créer une version de démonstration d'un logicel.Merci Trial Version Delphi 6 ! [ par titi29 ] J'ai réalisé un programme avec la version Trial de Delphi 6 Entreprise. J'ai compilé mon programme avant la fin de ma période de 60 jours.Et les 60 jo pb infos de version [ par smazaudi ] Bonjour à tous Voilà, je développe actuellement en Delphi 5 (je sais que c'est dépassé mais je n'ai pas le choix). Je viens d'améliorer mon soft et d Un programme pour modifier le numéro de version [ par vivelesquads ] Bonjour,J'ai besoin d'écrire un programme avec Delphi 7 qui puisse modifier le numéro de version d'un exécutable(créé par Delphi mais je ne pense pas Version de logiciel utilisé [ par WhiteHippo ] Qu'en pensez-vous ? Ne serait-il pas intéressant d'avoir dans le forum, à côté du nom du membre ou ailleurs (Hint ??, mais rapidement accessible) la v Problème avec la procedure Exit [ par christophedlr ] Bonjour,Dans mon programme, j'ai fait une DLL contenant des fonctions que j'utilise dans le programme ainsi que dans l'utilitaire de mise à jour.J'ai Relancer un programme [ par manu00 ] Bonjour,J'aimerai que mon application que je fais en delphi, a son lancement, demarre un autre logiciel, qu'a sa fermeture, elle ferme ce logiciel (se Informations de version d'un projet [ par vincentstryckmans ] Bonjour,Je souhaite récupérer les infos de version de mon projet et les afficher dans mon appli.J'utilise l'exemple donné dans l'aide de delphi (Bouto Chemin base des données sur le serveur non trouvé [ par notrica ] Salut,J'ai installer mon logiciel sur le serveur win 2003, la base des données se trouve dans un repertoire different de là où se trouve le programme.


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :

Comparez les prix Nouvelle version

Photothèque Nouveau !



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
Temps d'éxécution de la page : 0,437 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.