كيف يتم توقيف بطاقة الشبكةو عمل فورمات للقرص برمجيا
#1
السلام عليكم اخوتي الأعزاء
لدي سؤالين :
1- كيف يتم عمل فورمات للقرص برمجيا مثال القرص d ؟
2- كيف يتم توقيف بطاقة الشبكة برمجيا ؟
الرد
#2
وعليكم السلام ورحمة الله
لم أجربها:
كود :
// This is how to format a drive (be careful with this one). procedure FormatDriveDialog; begin ShellExecute(Application.Handle, 'Open', 'C:\Windows\Rundll32.exe', 'Shell32.dll,SHFormatDrive', 'C:\Windows', SW_SHOWNORMAL); end; function SHFormatDrive(hWnd : HWnd; Drive, fmtID, Options : LongInt):longint; stdcall; external 'shell32.dll'; procedure QuietFormatDrive; const SHFMT_ID_DEFAULT = $FFFF; SHFMT_OPT_QUICK = $0000; SHFMT_OPT_FULL = $0001; SHFMT_OPT_SYSONLY = $0002; SHFMT_ERROR = $FFFFFFFF; SHFMT_CANCEL = $FFFFFFFE; SHFMT_NOFORMAT = $FFFFFFFD; begin case SHFormatDrive(Handle, 0, SHFMT_ID_DEFAULT, SHFMT_OPT_FULL) of SHFMT_ERROR : ShowMessage('Error on last format, drive may be formatable'); SHFMT_CANCEL : ShowMessage('Last format was canceled'); SHFMT_NOFORMAT : ShowMessage('Drive is not formatable'); end; end;
إقتباس :كيف يتم توقيف بطاقة الشبكة برمجيا ؟
أنظر المرفق
بالتوفيق.


الملفات المرفقة
.rar   IPConfigClasses.rar (الحجم : 28.81 ك ب / التحميلات : 27)
الرد
#3
كود :
unit Unit1; interface uses Windows, Messages, Classes, Controls,StdCtrls, Forms,Menus,Dialogs, Buttons, ComCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private function formater : longint; end; function SHFormatDrive(hWnd : HWND;Drive : Word;fmtID : Word;Options : Word) : Longint stdcall; external 'Shell32.dll' name 'SHFormatDrive'; const SHFMT_DRV_A = 0; const SHFMT_DRV_B = 1; const SHFMT_ID_DEFAULT = $FFFF; const SHFMT_OPT_QUICKFORMAT = 0;{formatage rapide} const SHFMT_OPT_FULLFORMAT = 1;{formatage complet} const SHFMT_OPT_SYSONLY = 2; {copier seulement les fichiers systémes const SHFMT_ERROR = -1;{Erreur lors du formatage (disque protégé etc..} const SHFMT_CANCEL = -2;{Annulation du formatage} const SHFMT_NOFORMAT = -3;{Pas de formatage} var Form1: TForm1; implementation {$R *.DFM} // Bouton qui fait appel à la fonction formater procedure TForm1.Button1Click(Sender: TObject); begin // Exécution et controle du code retour Case formater of SHFMT_ERROR : ShowMessage('Erreur de formatage!!! changer de disquette '); SHFMT_CANCEL : ShowMessage('Formatage annulé par l''utilisateur'); SHFMT_NOFORMAT : ShowMessage('Non formater'); end; end; // Fonction de formatage utilisant l'API Shell32 function Tform1.formater : longint; var FmtRes : longint; begin result:= ShFormatDrive(Handle,SHFMT_DRV_A,SHFMT_ID_DEFAULT,SHFMT_OPT_QUICKFORMAT); end; end.
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم