📄 systemph.pas
字号:
unit SystemPH;
interface
uses Forms,Windows,Sysutils,Controls,AppUtils,Inifiles,systemLogoFaceFM;
///////////////////////////////////////////////////////////////////
// 以下定义的全局变量用于整个系统,均在系统开始时应用
///////////////////////////////////////////////////////////////////
const
SystemConst_AppName ='ECSCMANAGER'; //本机内部程序名称
SystemConst_AppVer ='1.0000'; //本机内部程序版本号
SystemConst_AppExplain ='电力客户服务中心--信息维护系统'; //本机内部程序说明
SystemConst_Debugstate =true; //系统调试状态
//the data here must be modified to get information
SystemConst_AliasName ='ECSC_SQL';//'MUIM_SQL';
SystemConst_BDEDataBaseName ='ECSC';
SystemConst_ServerName ='CTI-SERVER';
SystemConst_UserName ='ECSC_SA';
SystemConst_PassWord ='355113';
SystemConst_DatabaseName ='DBECSC';//'dbMUIM';
function ReadIni(const Section, Ident, Default: string): string;
function WriteIni(const Section, Ident, Value: string):boolean;
function SystemInit:boolean;
procedure LoadLogo;
procedure SetLogo(Position:integer);
procedure FreeLogo;
function FindForm(FormClass: TFormClass;const Caption: string):TForm;
procedure OpenForm(Sender: TObject; FormClass: TFormClass;const Caption: string='');
procedure WebIsHide(WebInt:integer);
implementation
uses EcscMain;
function SystemInit:boolean;
var
WndHandle:THandle;
begin
result:=true;
WndHandle:=FindWindow(PChar('TFormMain'),SystemConst_AppExplain);
if WndHandle<>0 then
begin
//如果系统已启动则激活
SetForegroundWindow(wndHandle);
result:=false;
end;
end;
procedure LoadLogo;
begin
frm_LogoFace:=Tfrm_LogoFace.Create(Application);
try
frm_LogoFace.Show;
frm_LogoFace.Update;
except
end;
end;
procedure SetLogo(Position:integer);
begin
frm_LogoFace.P.Position:=Position;
frm_LogoFace.P.Update;
end;
procedure FreeLogo;
begin
frm_LogoFace.P.Position:=100;
frm_LogoFace.Hide;
frm_LogoFace.Free;
end;
function ReadIni(const Section, Ident, Default: string): string;
var
tempIni:TIniFile;
STemp:String;
begin
tempIni:=nil;
sTemp:=ExtractFileName(Application.ExeName);
if pos('.',sTemp)>0 then
sTemp:=copy(sTemp,1,pos('.',sTemp))+'ini';
sTemp:=ExtractFilePath(Application.ExeName)+sTemp;
try
tempIni:= TIniFile.Create(sTemp);
result:=tempIni.ReadString(Section,Ident,Default);
finally
tempIni.Free;
end;
end;
function WriteIni(const Section, Ident, Value: string):boolean;
var
tempIni:TIniFile;
STemp:String;
begin
tempIni:=nil;
sTemp:=ExtractFileName(Application.ExeName);
if pos('.',sTemp)>0 then
sTemp:=copy(sTemp,1,pos('.',sTemp))+'ini';
sTemp:=ExtractFilePath(Application.ExeName)+sTemp;
try
Result:=false;
tempIni:= TIniFile.Create(sTemp);
tempIni.WriteString(Section,Ident,Value);
result:=true;
finally
tempIni.Free;
end;
end;
function FindForm(FormClass: TFormClass;const Caption: string):TForm;
var
I: Integer;
begin
Result := nil;
for I := 0 to Screen.FormCount - 1 do begin
if Screen.Forms[I] is FormClass then
if (Caption = '') or (Caption = Screen.Forms[I].Caption) then begin
Result := Screen.Forms[I];
Break;
end;
end;
end;
procedure OpenForm(Sender: TObject; FormClass: TFormClass;const Caption: string='');
var
tempForm: TForm;
begin
Screen.Cursor := crHourGlass;
try
tempForm:= FindShowForm(FormClass, Caption);
tempForm.WindowState:=wsMaximized;
tempForm.Update;
finally
Screen.Cursor := crDefault;
end;
end;
procedure WebIsHide(WebInt:integer);
begin
if WebInt=0 then
begin
Form_Main.WebBrowser1.Show;
if not Form_Main.mmi_View_Add.Enabled then Form_Main.mmi_View_Add.Enabled:=true;
if not Form_Main.mmi_View_Link.Enabled then Form_Main.mmi_View_Link.Enabled:=true;
Form_Main.mmi_View_Link.Checked:=true;
Form_Main.mmi_View_Add.Checked:=true;
Form_Main.CoolBar1.Bands[2].Visible:=true;
Form_Main.CoolBar1.Bands[3].Visible:=true;
Form_Main.StatusBar1.Panels[0].Text:=Form_Main.URLs.Text;
end else
begin
Form_Main.WebBrowser1.Hide;
if Form_Main.mmi_View_Add.Checked then Form_Main.mmi_View_Add.Checked:=false;
if Form_Main.mmi_View_Link.Checked then Form_Main.mmi_View_Link.Checked:=false;
Form_Main.mmi_View_Add.Enabled:=false;
Form_Main.mmi_View_Link.Enabled:=false;
Form_Main.CoolBar1.Bands[2].Visible:=false;
Form_Main.CoolBar1.Bands[3].Visible:=false;
Form_Main.StatusBar1.Panels[0].Text:='';
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -