看看这个例子????
Library UserDll;
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
Dialogs,ComCtrls,ExtCtrls,StdCtrls,FileCtrl,ShellApi,
Function1 in 'Function1.pas';
{$R *.res}
Exports
RemoveInvalid,
DecToBase;
begin
end.
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
unit Function1;
interface
uses
//请根据情况是否要加上ShareMem单元,注意ShareMem单元必须放在第一个
//如果加了ShareMem单元,请同时发布Borlndmm.dll
// ShareMem,
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,ComCtrls,ExtCtrls,StdCtrls,FileCtrl,Registry,IniFiles,ShellApi;
function RemoveInvalid(what, where: string): string
stdcall;
function DecToBase( Decimal: LongInt
const Base: Byte): String
stdcall;
implementation
{从字符串中删除指定字符串
用法:
NewStr:=RemoveInvalid('<invalid>','This <invalid> is my string and I wan to
remove the word <invalid>');}
function RemoveInvalid(what, where: string): string;
var
tstr: string;
begin
tstr:=where;
while pos(what, tstr)>0 do
tstr:=copy(tstr,1,pos(what,tstr)-1) +
copy(tstr,pos(what,tstr)+length(tstr),length(tstr));
Result:=tstr;
end;
{ }
function DecToBase( Decimal: LongInt
const Base: Byte): String;
const
Symbols: String[16] = '0123456789ABCDEF';
var
scratch: String;
remainder: Byte;
begin
scratch := '';
repeat
remainder := Decimal mod Base;
scratch := Symbols[remainder + 1] + scratch;
Decimal := Decimal div Base;
until ( Decimal = 0 );
Result := scratch;
end;
end.