📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
ComboBox1: TComboBox;
Label3: TLabel;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetString(Number:Integer;MaskStr:String):String;
function AnserStr(ty:Integer):String;
end;
TGetString=Function (Number:Integer):String;
//function getstring(Num:Integer):String;External 'wfh.dll';
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.AnserStr(ty:Integer):String;
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
var
sn:string;
hInstance:Cardinal;
GetString:TGetString;
begin
hInstance:=LoadLibrary('wfh.dll');
if hInstance<>0 then
begin
GetString:=GetProcAddress(hInstance,'GetString');
Edit5.Text:=GetString(12);
end;
freeLibrary(hInstance);
end;
Function TForm1.GetString(Number:Integer;MaskStr:String):string;
var
SetChar:Array[0..61] of char;
Temp:Array of char;
i:Integer;
tmp:String;
begin
for i:=0 to 9 do
SetChar[i]:=chr(i+48);
for i:=10 to 35 do
SetChar[i]:=chr(i+55);
for i:=36 to 61 do
SetChar[i]:=chr(i+61);
Randomize();
SetLength(Temp,number-1);
for i:=0 to number-1 do
begin
tmp:='';
if length(trim(MaskStr))>=i then
tmp:=Copy(trim(MaskStr),i+1,1)
else
tmp:='';
if tmp='A' then
Temp[i]:=SetChar[Random(10000) mod 26 + 10]
else if tmp='a' then
Temp[i]:=SetChar[Random(10000) mod 26 + 36]
else if tmp='#' then
Temp[i]:=SetChar[Random(10000) mod 52 + 10]
else if tmp='9' then
Temp[i]:=SetChar[Random(10000) mod 10]
else
Temp[i]:=SetChar[Random(10000) mod 61];
tmp:='';
end;
result:=pchar(Temp);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit5.Text:=GetString(20,ComboBox1.Text);
Edit1.Text:=Copy(Edit5.Text,0,4);
Edit2.Text:=Copy(Edit5.Text,5,4);
Edit3.Text:=Copy(Edit5.Text,9,4);
Edit4.Text:=Copy(Edit5.Text,13,4);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -