1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
| unit ValidPDF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, JvExForms, JvCustomItemViewer, JvImagesViewer, StdCtrls, Grids,
DBGrids, dblookup, OleCtrls, SHDocVw;
type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
WebBrowser1: TWebBrowser;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
procedure ListBox1DblClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
Nom_Fichier : string;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var
Chemin_dossier : String;
Info : TSearchRec;
Chemin_Source : String;
Chemin_Dest : String;
result : boolean;
begin
Chemin_Source := 'C:\Documents and Settings\informaticien\Bureau\Valid_PDF\En attente\+ Nom_Fichier' ;
Chemin_Dest := 'C:\Documents and Settings\informaticien\Bureau\Valid_PDF\Accepté\+ Nom_Fichier' ;
ShowMessage (Chemin_Source);
ShowMessage (Chemin_Dest);
MoveFileEx(PChar(Chemin_Source),PChar(Chemin_Dest), MOVEFILE_COPY_ALLOWED);
ListBox1.Items.clear;
{ Pour être sur que la barre oblique finisse le nom du chemin }
Chemin_dossier := IncludeTrailingPathDelimiter('C:\Documents and Settings\informaticien\Bureau\Valid_PDF\En attente');
{ Recherche de la première entrée du répertoire }
If FindFirst(Chemin_dossier+'*.*',faAnyFile,Info)=0 Then
Begin
Repeat
{ Les fichiers sont affichés dans ListBox1 }
{ Les répertoires sont affichés dans ListBox2 }
ListBox1.Items.Add(Info.FindData.cFileName)
{ Il faut ensuite rechercher l'entrée suivante }
Until FindNext(Info)<>0;
{ Dans le cas ou une entrée au moins est trouvée il faut }
{ appeler FindClose pour libérer les ressources de la recherche }
FindClose(Info);
end;
end;
procedure TForm1.FormShow(Sender: TObject);
Var
Chemin_dossier : String;
Info : TSearchRec;
begin
ListBox1.Items.clear;
{ Pour être sur que la barre oblique finisse le nom du chemin }
Chemin_dossier := IncludeTrailingPathDelimiter('C:\Documents and Settings\informaticien\Bureau\Valid_PDF\En attente');
{ Recherche de la première entrée du répertoire }
If FindFirst(Chemin_dossier+'*.*',faAnyFile,Info)=0 Then
Begin
Repeat
{ Les fichiers sont affichés dans ListBox1 }
{ Les répertoires sont affichés dans ListBox2 }
ListBox1.Items.Add(Info.FindData.cFileName)
{ Il faut ensuite rechercher l'entrée suivante }
Until FindNext(Info)<>0;
{ Dans le cas ou une entrée au moins est trouvée il faut }
{ appeler FindClose pour libérer les ressources de la recherche }
FindClose(Info);
End;
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
Var
Chemin_fichier : string;
Dlg: TopenDialog ;
begin
Nom_Fichier := ListBox1.items[ListBox1.itemindex] ;
Edit1.Text := Nom_Fichier;
Chemin_fichier := 'C:\Documents and Settings\informaticien\Bureau\Valid_PDF\En attente\'
+ Nom_Fichier;
Dlg:= TopenDialog.Create(nil) ;
Dlg.FileName:= Chemin_fichier;
Try
if Dlg.Execute Then
webbrowser1.Navigate(dlg.FileName);
Finally
Freeandnil(Dlg);
End ;
end;
end. |
Partager