⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u_global_setting.pas

📁 学员管理的软件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit U_global_setting;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdTrivialFTPBase,NB30,Registry,StdCtrls,shellapi, Spin,
  ExtCtrls, StrUtils,Buttons, ComCtrls,inifiles, CheckLst, ImgList;

type
  TF_setting = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    GroupBox1: TGroupBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    CheckBox3: TCheckBox;
    GroupBox2: TGroupBox;
    RadioGroup1: TRadioGroup;
    GroupBox3: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    SpinEdit1: TSpinEdit;
    SpinEdit2: TSpinEdit;
    SpinEdit3: TSpinEdit;
    SpinEdit4: TSpinEdit;
    SpinEdit5: TSpinEdit;
    SpinEdit6: TSpinEdit;
    SpinEdit7: TSpinEdit;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    CheckBox7: TCheckBox;
    CheckBox8: TCheckBox;
    CheckBox9: TCheckBox;
    CheckBox12: TCheckBox;
    TabSheet5: TTabSheet;
    GroupBox5: TGroupBox;
    CheckListBox1: TCheckListBox;
    GroupBox6: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    GroupBox7: TGroupBox;
    RadioGroup2: TRadioGroup;
    TabSheet6: TTabSheet;
    del_sj: TRadioGroup;
    GroupBox8: TGroupBox;
    CheckBox11: TCheckBox;
    GroupBox9: TGroupBox;
    del_: TRadioGroup;
    BitBtn3: TBitBtn;
    CheckBox13: TCheckBox;
    autosize_form: TRadioGroup;
    CheckBox2: TCheckBox;
    CheckBox14: TCheckBox;
    CheckBox15: TCheckBox;
    CheckBox16: TCheckBox;
    CheckBox17: TCheckBox;
    RadioGroup3: TRadioGroup;
    BitBtn4: TBitBtn;
    GroupBox10: TGroupBox;
    CheckBox6: TCheckBox;
    GroupBox11: TGroupBox;
    CheckBox1: TCheckBox;
    CheckBox18: TCheckBox;
    Panel1: TPanel;
    GroupBox4: TGroupBox;
    BitBtn5: TBitBtn;
    hardware_info: TMemo;
    tip_order: TRadioGroup;
    Bevel1: TBevel;
    Label10: TLabel;
    HotKey1: THotKey;
    Label11: TLabel;
    HotKey2: THotKey;
    Label12: TLabel;
    HotKey3: THotKey;
    Label13: TLabel;
    HotKey4: THotKey;
    Label14: TLabel;
    HotKey5: THotKey;
    Bevel2: TBevel;
    Bevel3: TBevel;
    ImageList1: TImageList;
    ColorDialog1: TColorDialog;
    FontDialog1: TFontDialog;
    TabSheet7: TTabSheet;
    GroupBox13: TGroupBox;
    selitems: TCheckListBox;
    GroupBox12: TGroupBox;
    Label15: TLabel;
    SpeedButton1: TSpeedButton;
    Label16: TLabel;
    SpeedButton2: TSpeedButton;
    Label17: TLabel;
    SpeedButton3: TSpeedButton;
    Label18: TLabel;
    SpeedButton4: TSpeedButton;
    Label19: TLabel;
    SpeedButton5: TSpeedButton;
    SpeedButton6: TSpeedButton;
    Label20: TLabel;
    CheckBox10: TCheckBox;
    Label21: TLabel;
    SpeedButton7: TSpeedButton;
    Label22: TLabel;
    SpeedButton8: TSpeedButton;
    RadioGroup4: TRadioGroup;
    TabSheet8: TTabSheet;
    en_decode_set: TRadioGroup;
    Timer1: TTimer;
    Button1: TButton;
    Button2: TButton;
    GroupBox14: TGroupBox;
    Label23: TLabel;
    manage_qx: TCheckListBox;
    Label24: TLabel;
    Label25: TLabel;
    oper_qx: TCheckListBox;
    text_qx: TCheckListBox;
    GroupBox15: TGroupBox;
    howmanyday: TEdit;
    Label26: TLabel;
    procedure FormShow(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
     procedure BitBtn5Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure SpeedButton7Click(Sender: TObject);
    procedure SpeedButton8Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure selitemsClick(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure hardware_infoDblClick(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
    procedure howmanydayKeyPress(Sender: TObject; var Key: Char);
  private
    hotkeyid:array[1..5] of integer;
    procedure hotkeydown(var msg:Tmessage);
    message wm_hotkey;
    procedure disk_infos_refresh;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_setting: TF_setting;
  which_speedbutton:integer;
  timer_isenable:boolean=false;
implementation
uses main,global,submain;
type
TNBLANARESOURCES=(LRALLOC,LRFREE);
type
PNACADDRESS=^TMACADDRESS;
TMACADDRESS=ARRAY[0..5] OF BYTE;
TYPE
TGATE=RECORD
OFF2,OP,SEG,OFF1:WORD;
END;
LONGDWORD=INT64;
{$R *.dfm}
var
keystr:array[1..5] of string;
reg:Tregistry;
temp:integer;
key1,key2,key3,key4,key5:byte;

// use dll
function encode(s:shortstring):shortstring;stdcall;external 'en_de_code.dll';
function decode(s:shortstring):shortstring;stdcall;external 'en_de_code.dll';

procedure TF_setting.disk_infos_refresh;
var
 osv:osversioninfo;
 sysinfo:system_info;
 meminfo:memorystatus;
begin
hardware_info.Clear;
//设置版本信息结构的大小
osv.dwOSVersionInfoSize:=sizeof(osversioninfo);
//获取版本信息
getversionex(osv);
//显示
hardware_info.Lines.Add('操作系统版本'+inttostr(osv.dwMajorVersion)+'.'
+inttostr(osv.dwMinorVersion)+'.'+inttostr(osv.dwBuildNumber)+'.'
+inttostr(osv.dwPlatformId)+'.'+osv.szCSDVersion);
//获取cpu信息
getsysteminfo(sysinfo);
hardware_info.Lines.Add('系统中共有'+inttostr(sysinfo.dwNumberOfProcessors)+'个CPU');
CASE SYSinfo.dwProcessorType of
386:hardware_info.Lines.Add('CPU类型为386系列');
486:hardware_info.Lines.Add('CPU类型为486系列');
586:hardware_info.Lines.Add('CPU类型为奔腾系列');
end;
case osv.dwPlatformId of
ver_platform_win32s:
   hardware_info.Lines.Add('操作系统:Window 3.1');
ver_platform_win32_windows:
   hardware_info.lines.Add('操作系统:windows 95');
ver_platform_win32_NT:
   hardware_info.lines.Add('操作系统:windows NT');
end;
hardware_info.Lines.add('其他信息:'+osv.szCSDVersion);
hardware_info.Lines.add('屏幕宽度:'+inttostr(getsystemmetrics(sm_cxscreen)));
hardware_info.Lines.add('屏幕高度:'+inttostr(getsystemmetrics(sm_cyscreen)));
hardware_info.Lines.add('水平边界宽度:'+inttostr(getsystemmetrics(sm_cxborder)));
hardware_info.Lines.add('垂直边界宽度:'+inttostr(getsystemmetrics(sm_cyborder)));
hardware_info.Lines.add('水平滚动宽度:'+inttostr(getsystemmetrics(sm_cxhscroll)));
hardware_info.Lines.add('垂直滚动宽度:'+inttostr(getsystemmetrics(sm_cyhscroll)));
hardware_info.Lines.add('标题栏高度:'+inttostr(getsystemmetrics(sm_cycaption)));
case getsystemmetrics(sm_mousepresent) of
1:
   hardware_info.Lines.Add('有鼠标');
else
   hardware_info.Lines.Add('无鼠标');
end;
hardware_info.Lines.add('鼠标有:'+inttostr(getsystemmetrics(sm_cmousebuttons))+'键');
hardware_info.Lines.add('鼠标水平双击范围:'+inttostr(getsystemmetrics(sm_cxdoubleclk)));
hardware_info.Lines.add('鼠标垂直双击范围:'+inttostr(getsystemmetrics(sm_cydoubleclk)));
hardware_info.Lines.add('光标宽度为:'+inttostr(getsystemmetrics(sm_cxcursor)));
hardware_info.Lines.add('光标高度为:'+inttostr(getsystemmetrics(sm_cycursor)));
hardware_info.Lines.add('图标宽度为:'+inttostr(getsystemmetrics(sm_cxicon)));
hardware_info.Lines.add('图标高度为:'+inttostr(getsystemmetrics(sm_cyicon)));
meminfo.dwLength:=sizeof(memorystatus);
globalmemorystatus(meminfo);
hardware_info.Lines.Add(inttostr(meminfo.dwMemoryLoad)+'%的内存正在使用中...');
hardware_info.Lines.Add('物理内存有:'+inttostr(meminfo.dwTotalPhys)+'字节');
hardware_info.Lines.Add('未使用的物理内存有:'+inttostr(meminfo.dwAvailPhys)+'字节');
hardware_info.Lines.Add('交换文件大小为:'+inttostr(meminfo.dwTotalPageFile)+'字节');
hardware_info.Lines.Add('未使用的交换文件大小为:'+inttostr(meminfo.dwAvailPageFile)+'字节');
hardware_info.Lines.Add('虚拟内存有:'+inttostr(meminfo.dwTotalVirtual)+'字节');
hardware_info.Lines.Add('未使用的虚拟内存有:'+inttostr(meminfo.dwAvailVirtual)+'字节');
end;

procedure TF_setting.hotkeydown(var msg:Tmessage);
var
hasctrl,hasalt,hasshift,hasnone:boolean;
begin
if pos('SHIFT',KEYSTR[1])>=0 then
hasshift:=true
else if pos('CTRL',KEYSTR[1])>=0 THEN
HASCTRL:=TRUE
ELSE IF POS('ALT',KEYSTR[1])>=0 THEN
HASALT:=TRUE
ELSE
HASNONE:=TRUE;
if hasshift then
begin
if (msg.LParamHi=key1) and (msg.LParamLo = mod_shift) then
application.BringToFront;
end
else if hasctrl then
begin
if (msg.LParamHi=key1) and (msg.LParamLo = mod_control) then
application.BringToFront;
end
else if hasalt then
begin
if (msg.LParamHi=key1) and (msg.LParamLo = mod_alt) then
application.BringToFront;
end
else
begin
if (msg.LParamHi=key1) then
application.BringToFront;
end;

end;


procedure TF_setting.FormShow(Sender: TObject);
var
myfile,myfile1:Tinifile;
begin
combobox2.Items:=screen.Fonts;
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
myfile1:=Tinifile.Create(extractfilepath(application.ExeName)+'tip.ini');

//form setting
checkbox1.Checked:=myfile.readBool('form_setting','showhardwareinfo',false);
autosize_form.ItemIndex:=myfile.readinteger('form_setting','auto_size',2);
checkbox2.Checked:=myfile.ReadBool('form_setting','grid_linecolor',true);

//grid print setting
spinedit1.Value:=myfile.ReadInteger('grid_print','left_margine',1);
spinedit2.Value:=myfile.ReadInteger('grid_print','right_margine',1);
spinedit3.Value:=myfile.ReadInteger('grid_print','top_margine',1);
spinedit4.Value:=myfile.ReadInteger('grid_print','buttom_margine',1);
combobox1.Text:=myfile.ReadString('grid_print','print_pos','横向打印');
combobox2.Text:=myfile.ReadString('grid_print','font_name','宋体');
spinedit5.Value:=myfile.ReadInteger('grid_print','font_size',12);
spinedit7.Value:=myfile.ReadInteger('grid_print','horz',1);
spinedit6.Value:=myfile.ReadInteger('grid_print','vert',1);
//database setting
radiogroup1.ItemIndex:=myfile.ReadInteger('database_setting','tip_backup',2);
checkbox6.Checked:=myfile.ReadBool('datebase_setting','dbgrid_canwrite',false);
checkbox18.Checked:=myfile.readBool('database_setting','grid_blank',false);

//other setting
checkbox3.Checked:=myfile.ReadBool('other_setting','auto_saveall',false);
checkbox5.Checked:=myfile.ReadBool('other_setting','ontop',false);
checkbox13.Checked:=myfile.ReadBool('other_setting','auto_show_keybroad',true);
checkbox14.Checked:=myfile.ReadBool('other_setting','disable_altf4',false);
checkbox15.Checked:=myfile.ReadBool('other_setting','disable_alttab',false);
checkbox16.Checked:=myfile.ReadBool('other_setting','disable_ctrlaltdel',false);
checkbox17.Checked:=myfile.ReadBool('other_setting','opensound',false);
checkbox8.Checked:=myfile1.ReadBool('tip','show',true);
checkbox10.Checked:=myfile.ReadBool('other_setting','showfont',false);
checkbox12.Checked:=myfile.readBool('other_setting','pmd',false);
radiogroup4.ItemIndex:=myfile.readInteger('other_setting','xp',0);
tip_order.ItemIndex:=myfile.readInteger('other_setting','tip_order',0);
//secret and permission
en_decode_set.ItemIndex:=myfile.readInteger('permission','en_decode',0);
myfile1.Free;
myfile.Free;
end;

procedure TF_setting.BitBtn1Click(Sender: TObject);
var
myfile,myfile1:Tinifile;
mypath:string;
ss:shortstring;
strsql:string;
mq,mu,md,oq,ou,od,tq,tu,td:byte;
begin
if manage_qx.Checked[0] then
mq:=1
else
mq:=0;
if manage_qx.Checked[1] then
mu:=1
else
mu:=0;
if manage_qx.Checked[2] then
md:=1
else
md:=0;

if oper_qx.Checked[0] then
oq:=1
else
oq:=0;
if oper_qx.Checked[1] then
ou:=1
else
ou:=0;
if oper_qx.Checked[2] then
od:=1
else
od:=0;
if text_qx.Checked[0] then
tq:=1
else
tq:=0;
if text_qx.Checked[1] then
tu:=1
else
tu:=0;
if text_qx.Checked[2] then
td:=1
else
td:=0;
(*
with main.DataModule2 do
begin
  aq1.Close;
  aq1.SQL.Clear;
  aq1.SQL.Add('select * from 系统参数表');
  aq1.Open;
  if aq1.Eof then
  begin
    aq1.Insert;
    aq1.FieldByName('管理员删除权限').AsInteger:=md;
    aq1.FieldByName('管理员更新权限').AsInteger:=mu;
    aq1.FieldByName('管理员查询权限').AsInteger:=mq;
    aq1.FieldByName('操作员删除权限').AsInteger:=od;
    aq1.FieldByName('操作员更新权限').AsInteger:=ou;
    aq1.FieldByName('操作员查询权限').AsInteger:=oq;
    aq1.FieldByName('考试人删除权限').AsInteger:=td;
    aq1.FieldByName('考试人更新权限').AsInteger:=tu;
    aq1.FieldByName('考试人查询权限').AsInteger:=tq;
    aq1.Post;
  end
  else
  begin
//    strsql:='update 系统参数表 set 管理员删除权限='+inttostr(md)+',管理员更新
  end;
end;
*)
if checkbox4.Checked then
begin
if  messagedlg('你确定要软件开机就运行么?',mtwarning,[mbyes,mbno],0)=mryes then
begin
  mypath:=extractfilepath(application.ExeName);
  reg.WriteString('project1',mypath+'project1.exe');
  reg.CloseKey;
  reg.Free;
end;
end;
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
//form setting

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -