我新建一个unit,没有窗体的。我想将我收集的一些函数和过程统一写进这个uint中,让他形成一个函数过程库,方便以后直接调用,就不用写代码了。但是在自定义过程的时候报错。我在有窗体的时候用同样的方法自定义过程没错呀,大侠请执教,我是不是少些什么,怎么可以实现,请说得详细些!
解决方案 »
- 用delphi7写的程序生成.exe文件点击运行 无法运行的问题 急用 谢谢!
- 初学EDLPHI数据库编程,有点小问题望高手指教
- 急阿!!!!再线等!!dbedit问题!!
- delphi连接数据库的相对路径问题?
- 请教一个自动编号的问题
- 如何把XML文件的数据导入到数据库中?
- 问一个很容易的算法问题,有四个数a,b,c,d..........
- 关于图片指针问题,需要高手指点
- 显示动画
- 百分全送,再送百分,请问个位高手,怎么看待VB和DELPHI,优势分别是什么啊! 还有IT认证, 国家,和公司的那个更具优势
- 怎么将Excel文件调入Dbgrid中?
- 我装完cbuilder6,delphi6中的fastreport就不能用了??????显示rtl60.bpl错误
unit WrBaseValue;interface
uses
inifiles,Classes,SysUtils;type
TLSInfo = record //记录索的信息
Sh : integer;
DS : integer;
SL : integer;
GG : integer;
end;
TActionType = (atEncryption,atDecryption);
TTomEncryption = class(TComponent)
private
{ Private declarations }
FInputString:string;
FOutputString:string;
FHexInputString:string;
FHexOutputString:string;
FKeyString:string;
FAction:TActionType;
procedure SetInputString(input:string);
procedure SetOutputString(input:string);
procedure SetKeyString(input:string);
Function EncryptionEngine (Src:String; Key : String; Encrypt : Boolean):String;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent);override;
Procedure Execute;
function Encry(wAction : TActionType;InputStr: string): string;
published
{ Published declarations }
property Input: String read FInputString write SetInputString;
property Output: String read FOutputString write SetOutputString;
property Key: String read FKeyString write SetKeyString;
property Action: TActionType read FAction write FAction default atEncryption;
end;
TWRBaseValue = class
private
FilePath : String;
LSCount : integer;
Encry : TTomEncryption; inifile : Tinifile;
public
LsArray : array of TLSInfo;
constructor Create;
destructor Destroy;
procedure InitLsArrayFromIniFile; end;var
BaseValue : TWRBaseValue;implementation
constructor TWRBaseValue.Create;
begin
inherited;
FilePath := ExtractFilePath(ParamStr(0)) + 'BaseConfig.YAC';
inifile := TIniFile.Create(FilePath);
LsCount := 34;
Encry := TTomEncryption.Create(nil);
setLength(LsArray,LsCount);
InitLsArrayFromIniFile;end;destructor TWRBaseValue.Destroy;
begin
inherited;
inifile.Free;
end;procedure TWRBaseValue.InitLsArrayFromIniFile;
var
I : integer;
begin
LsCount := inifile.ReadInteger('BaseValue','Count',0);
SetLength(LsArray,LsCount);
Encry.Action := atDecryption; for i := 1 to 34 do
begin
Encry.Input := inifile.ReadString('BaseValue','DS'+intTostr(i),'');
Encry.Execute;
LsArray[i-1].Sh := i;
LsArray[i-1].DS := strToint(Encry.Output);
Encry.Input := inifile.ReadString('BaseValue','SL'+intTostr(i),'');
Encry.Execute;
LsArray[i-1].SL := strtoint(Encry.Output);
LsArray[i-1].GG := inifile.ReadInteger('BaseValue','GG'+intTostr(i),0);
end;
end;
但是为什么你把过程和函数统统放在private里面?一般来说我会把这些放在public里