中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 看雪学院专区 > Win32/Win64编程
虚拟文件工具 v1.0 源码 for delphi
作者:joe-lu 时间:2006-12-15 15:54 出处:pediy.com 责编:月夜寒箫
              摘要:虚拟文件工具 v1.0 源码 for delphi
源于:shoooo的epe国庆游戏~~

unit Un_main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, Buttons,shellapi,inifiles, WinSkinData;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    SpeedButton1: TSpeedButton;
    Edit2: TEdit;
    SpeedButton2: TSpeedButton;
    Edit3: TEdit;
    SpeedButton3: TSpeedButton;
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    SaveDialog1: TSaveDialog;
    SkinData1: TSkinData;
    ProgressBar1: TProgressBar;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  ini:tinifile;
  path,tmp:string;
  TimerID: Integer;
implementation

{$R *.dfm}
function ExtractFileNameEx(FileName: string): string;  //返回文件名
begin
  Result := ExtractFileName(FileName);
  Result := Copy(Result, 1, Length(Result) - length(ExtractFileExt(FileName)));
end;

function IsValidFileName(FileName: string): Boolean;
{
  判断FileName是否是合法的文件名,是,返回True,否则,返回False;
}
var
  i: integer;
begin
  result := True;
  for i := 1 to Length(FileName) do
    if FileName[i] in ['<', '>', '?', '/', ', ':', '*', '|', '"'] then
    begin
      result := False;
      Exit;
    end;
end;

procedure TimerFunc;
begin
  application.MessageBox('文件已经创建成功!','提示',MB_OK+MB_ICONINFORMATION);
  KillTimer(0, TimerID);
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
   if OpenDialog1.Execute then
   edit1.Text:=OpenDialog1.FileName;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
   if OpenDialog1.Execute then
   edit2.Text:=OpenDialog1.FileName;
   edit3.Text:=ExtractFilePath(OpenDialog1.FileName)+
   ExtractFileNameEx(OpenDialog1.FileName)+'_VM'+
   ExtractFileExt(OpenDialog1.FileName);
end;

procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
   if SaveDialog1.Execute  then
   edit3.Text:=SaveDialog1.FileName;
end;

procedure TForm1.Button1Click(Sender: TObject);
var M:TStringList;
begin
   if (FileExists(edit1.Text)) and (FileExists(edit2.Text)) and (IsValidFileName(ExtractFileNameEx(edit3.Text))) then
   begin
   tmp:=ExtractFileNameEx(Edit3.Text)+
   ExtractFileExt(Edit3.Text);
   path := ExtractFilePath(Application.ExeName);
   m:=TStringList.Create;
   m.Text:='copy '+'"'+edit2.Text+'"'+'/b +'+'"'+edit1.Text+'"'+'/b '+'"'+edit3.Text+'"';
   m.SaveToFile(path+'run.bat');
   m.Free;
   winexec(pchar(path+'run.bat'),SW_HIDE);
   ProgressBar1.Position:=20;
   sleep(1500);
   ProgressBar1.Position:=100;
   application.MessageBox(pchar('虚拟文件『'+tmp+' 』已经创建成功!'),'提示',MB_OK+MB_ICONINFORMATION);
   ProgressBar1.Position:=0;
   deletefile(path+'run.bat');
   end;
 end;

end.
所上传文件
vmprotool.rar (上传时间2006-10-11,11:22,347.2 KB,41 次点击)
关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有