📄 schoolinfo_unit.pas
字号:
unit SchoolInfo_Unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Base_Unit, StdCtrls, Buttons, Menus, StdActns, ActnList;
type
TfrmSchoolInfo = class(TfrmBase)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
edtSchoolName: TEdit;
edtSchoolAddress: TEdit;
edtLinkMan: TEdit;
edtType: TEdit;
btnOK: TBitBtn;
btnCancel: TBitBtn;
procedure btnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btnCancelClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmSchoolInfo: TfrmSchoolInfo;
implementation
uses
Common_Unit, DM_Unit;
{$R *.dfm}
procedure TfrmSchoolInfo.btnOKClick(Sender: TObject);
begin
try //动态加载DLL,DLL中包含了读取INI文件的函数
DLLHandle := LoadLibrary('CommInfo.dll');
@WriteIni := GetProcAddress(DLLHandle,'WriteIni');
if @WriteIni <> nil then
WriteIni(FileName,'Info','SchoolName',edtSchoolName.Text);
WriteIni(FileName,'Info','SchoolAddress',edtSchoolAddress.Text);
WriteIni(FileName,'Info','LinkMan',edtLinkMan.Text);
WriteIni(FileName,'Info','Type',edtType.Text);
Application.MessageBox('信息保存成功!','提示',64);
finally
FreeLibrary(DLLHandle); //释放DLL
end;
end;
procedure TfrmSchoolInfo.FormShow(Sender: TObject);
begin
inherited;
try //动态加载DLL,DLL中包含了读取INI文件的函数
DLLHandle := LoadLibrary('CommInfo.dll');
@ReadIni := GetProcAddress(DLLHandle,'ReadIni');
if @ReadIni <> nil then
edtSchoolName.Text := ReadIni(FileName,'Info','SchoolName');
edtSchoolAddress.Text := ReadIni(FileName,'Info','SchoolAddress');
edtLinkMan.Text := ReadIni(FileName,'Info','LinkMan');
edtType.Text := ReadIni(FileName,'Info','Type');
finally
FreeLibrary(DLLHandle); //释放DLL
end;
end;
procedure TfrmSchoolInfo.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
frmSchoolInfo := nil;
end;
procedure TfrmSchoolInfo.btnCancelClick(Sender: TObject);
begin
inherited;
Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -