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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, EjectUSB, StdCtrls, CheckLst, ExtCtrls, jpeg, Buttons, shellapi,
Menus, ComCtrls, Grids,Calendar,ShellCtrls;
type
TForm1 = class(TForm)
CheckListBox1: TCheckListBox;
Actualiser_La_Liste: TButton;
Image1: TImage;
MainMenu1: TMainMenu;
Fichier1: TMenuItem;
Edition1: TMenuItem;
Affichage1: TMenuItem;
Outils1: TMenuItem;
Options1: TMenuItem;
Aide1: TMenuItem;
Nouveau1: TMenuItem;
FicheUSB1: TMenuItem;
Motdepasse1: TMenuItem;
Listepriphriques1: TMenuItem;
Licone1: TMenuItem;
Afficher1: TMenuItem;
Retirerdelabarredestaches1: TMenuItem;
Chercher1: TMenuItem;
FicheUSB2: TMenuItem;
Ouvrir1: TMenuItem;
Enregistrer1: TMenuItem;
Enregistrersous1: TMenuItem;
Fermer1: TMenuItem;
Quitter1: TMenuItem;
Ejecter1: TMenuItem;
Fentre1: TMenuItem;
Montrer1: TMenuItem;
Cacher1: TMenuItem;
ProgressBar1: TProgressBar;
Timer4: TTimer;
Timer5: TTimer;
Timer6: TTimer;
Timer13: TTimer;
Actualiserlaliste1: TMenuItem;
Diagnostic2: TMenuItem;
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
procedure FormActivate(Sender: TObject);
procedure Actualiser_La_ListeClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure CheckListBox1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure DiagnosticClick(Sender: TObject);
procedure FicheUSB1Click(Sender: TObject);
procedure FicheUS1Click(Sender: TObject);
procedure FicheUSB2Click(Sender: TObject);
procedure Afficher1Click(Sender: TObject);
procedure Retirerdelabarredestaches1Click(Sender: TObject);
procedure Montrer1Click(Sender: TObject);
procedure Cacher1Click(Sender: TObject);
procedure Ejecter1Click(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure Timer5Timer(Sender: TObject);
procedure Timer6Timer(Sender: TObject);
procedure Timer13Timer(Sender: TObject);
procedure Diagnostic2Click(Sender: TObject);
procedure Motdepasse1Click(Sender: TObject);
procedure Actualiserlaliste1Click(Sender: TObject);
private
{ Déclarations privées }
Procedure EtatConnectionUSB(var Msg: TMessage);Message WM_DEVICECHANGE;
public
{ Déclarations publiques }
end;
var
Form1 : TForm1;
Eject : Boolean;
implementation
uses Unit2, Unit4, Unit3,Unit5;
{$R *.dfm}
{$R WindowsXP.res}
///////////////////////DETECTION CLES USB//////////////////////////////////////
Procedure TForm1.EtatConnectionUSB(var Msg: TMessage);
begin
// / Déconnexion physique / / Connexion physique /
if (Msg.wParam = $8004) or (Msg.wParam = $8000) then
if DEV_BROADCAST_HDR(Msg.LParam)^.dbch_devicetype=2 then
if DEV_BROADCAST_VOLUME(Msg.LParam)^.dbcv_flags=0 then
if not Eject then
begin
CheckListBox1.Clear;
Liste_USB(CheckListBox1.Items,True,True,True);
end;
;
;
;
;
end;
////////////ACTUALISER LA LISTE P2RIPH2RIQUE///////////////////////////////////
procedure TForm1.Actualiser_La_ListeClick(Sender: TObject);
begin
progressbar1.Position:=0 ;//on initialise la barprog a 0{le progressebar c'est juste pour la forme et pour faire jolie mais il a aucun role }
CheckListBox1.Clear; //
Liste_USB(CheckListBox1.Items,True,True,True);
progressbar1.Visible:=true;
progressbar1.position:=100 ;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
CheckListBox1.Clear;
// Liste_USB(Lecteurs:TStrings;DriveRemovable,DriveFixed,DriveCDRom:Boolean);
// Lecteurs : Récupération des volumes dans un TStrings
// DriveRemovable : Récupération des périphériques autres que disques et média USB
// DriveFixed : Récupération des disques USB
// DriveCDROM : Récupération des médias USB
Liste_USB(CheckListBox1.Items,True,True,True);//affichage des périphérique dans la listebox
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
label1.Caption:=datetimetostr(now);{pour Obtenir la date de type mardi 11 janvier 2013 }
label2.Caption:=formatdatetime('dddd dd mmmm yyyy',date);{pour Obtenir la date et lheur de type 11/1/2013 08:53:22}
end;
procedure TForm1.CheckListBox1Click(Sender: TObject);
begin
// Msg.wParam and not Eject
// then('C:\ProgramData\Microsoft\Windows\Start Menu\Programs'):=open ;
end;
//////////////CREATION DE LA FORM PéRIPHéRIQUE/////////////////////////////////
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowMainForm := false;
CheckListBox1.Visible:=false;
ShellExecute(Handle,'Open','',nil,nil,SW_HIDE);
// Application.ShowMainForm:=False;
end;
///////////////DIAGNOSTIC MANIUEL///////////////////////////////////////////////
procedure TForm1.DiagnosticClick(Sender: TObject);
begin
shellexecute(handle,'open',Pchar('C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'),nil,nil,SW_HIDE);
// on lance le diagnostic qui va allez chercher le (.exe) de l'antivirus pour faire un scan de la cles detecter avant utilisation
end;
procedure TForm1.FicheUSB1Click(Sender: TObject);
begin
form2.ShowModal;
// ou form2.Visible:=true;
end;
procedure TForm1.FicheUS1Click(Sender: TObject);
begin
form4.ShowModal;
// ou form4.Visible:=true;
end;
procedure TForm1.FicheUSB2Click(Sender: TObject);
begin
form3.ShowModal;
// ou form3.Visible:=true;
// et form1.Visible:=false;
end;
/////////////////AFFICHAGE ICONE SUR LA BARRE DE TACHES/////////////////////////
procedure TForm1.Afficher1Click(Sender: TObject);
begin
ShowWindow(Application.Handle, SW_SHOW);// remet l'icône de la barre des tâches
end;
procedure TForm1.Retirerdelabarredestaches1Click(Sender: TObject);
begin
ShowWindow(Application.Handle, SW_Hide);// retire l'icône de la barre des tâches
end;
///////////////////////AFFICHAGE DE LA LISTBOX/////////////////////////////////////
procedure TForm1.Montrer1Click(Sender: TObject);
begin
CheckListBox1.Visible:=true ;
end;
procedure TForm1.Cacher1Click(Sender: TObject);
begin
CheckListBox1.Visible:=false;
end;
///////////////////EJECT USB////////////////////////////////////////////////////
procedure TForm1.Ejecter1Click(Sender: TObject);
var
I : Integer;
Drive: String;
begin
for I := 0 to CheckListBox1.Count - 1 do
if CheckListBox1.Checked[I]
then
begin
Eject:=True;
Drive:=CheckListBox1.Items.Strings[i];
if MessageDlg('Extraire le support complet ?',mtConfirmation,[mbYes,mbNo],0)=mrYes
then
begin
if Eject_USB(Drive[1],4,300,True,True)
then
CheckListBox1.ItemEnabled[I]:=False;
end
else
begin
if Eject_USB(Drive[1],4,300,True,False) then
CheckListBox1.ItemEnabled[I]:=False;
end;
end;
CheckListBox1.Clear;
Liste_USB(CheckListBox1.Items,True,True,True);
Eject:=False;
end;
procedure TForm1.Timer4Timer(Sender: TObject);
begin
Application.MainForm.Show;// mettre visible la form principale
Timer4.enabled:=false;
end;
procedure TForm1.Timer5Timer(Sender: TObject);
begin
flashWindow(image1.Height,True);
end;
procedure TForm1.Timer6Timer(Sender: TObject);
begin
FlashWindow(Actualiser_La_Liste.Handle,True);
end;
procedure TForm1.Timer13Timer(Sender: TObject);
begin
if (progressbar1.position=100) and(progressbar1.Visible=true )
then
begin
progressbar1.Visible:=false
end;
;
end;
procedure TForm1.Diagnostic2Click(Sender: TObject);
begin
shellexecute(handle,'open',Pchar('C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'),nil,nil,SW_HIDE);
// on lance le diagnostic qui va allez chercher le (.exe) de l'antivirus pour faire un scan de la cles detecter avant utilisation
end;
////////////////button mot de passe/////////////////////////////////////////////
procedure TForm1.Motdepasse1Click(Sender: TObject);
begin
ASSIGNFILE (mot,pass) ;
IF ( FileExists (pass))
THEN
Reset (mot)
ELSE
REWRITE (mot)
;
form4.edit1.Text:='';
form4.edit2.Text:='';
form4.edit3.Text:='';
form4.edit6.Text:='';
end;
procedure TForm1.Actualiserlaliste1Click(Sender: TObject);
begin
progressbar1.Position:=0 ;//on initialise la barprog a 0
CheckListBox1.Clear; //
Liste_USB(CheckListBox1.Items,True,True,True);
progressbar1.Visible:=true;
progressbar1.position:=100 ;
end;
end.
//////////////////enregistrer///////////////////////////////////////////////////
procedure TForm2.EnregistrerClick(Sender: TObject);
begin
SEEK (USB,FILESIZE(USB)) ;
enreg.NUMERO_CLES:=edit1.Text;
enreg.TRANCHE:=edit2.Text;
enreg.NOM_KIT:=uppercase(edit3.Text);
enreg.DONNE_KIT:=edit5.Text;
enreg.MOT_DE_PASSE:=edit6.Text;
ComboBox1.text:=aha;
WRITE (USB, enreg) ;
//form3.ListBox1.Refresh ;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit5.Text:='';
edit6.Text:='';
// form1.visible:=false ;
end;
end. |
Partager