From e3917cfa3d13025d10fca55100d46fc55952a40b Mon Sep 17 00:00:00 2001 From: tslediter Date: Fri, 17 Nov 2023 16:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dpi鎰熺煡 --- funcext/tvclib/tslvcl.tsf | 4 +- funcext/tvclib/utslvclauxiliary.tsf | 135 +++++++++++++++++++++++++++ funcext/tvclib/uwindowsinterface.tsf | 4 +- 3 files changed, 140 insertions(+), 3 deletions(-) diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index dca3080..8845f2d 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -6609,7 +6609,9 @@ begin hd := 0; if(wnd is class(TWincontrol))and wnd.HandleAllocated()then hd := wnd.Handle; else if ifnumber(wnd)then hd := wnd; - return gettswin32api().MessageBoxA(hd,ifstring(txt)?txt:"",ifstring(title)?title:"",flag >= 0?flag:0); + api := gettswin32api(); + api.clipcursor(0); + return api.MessageBoxA(hd,ifstring(txt)?txt:"",ifstring(title)?title:"",flag >= 0?flag:0); end function GetCurrentTslDir(); //获得tsl目录以\结尾 begin diff --git a/funcext/tvclib/utslvclauxiliary.tsf b/funcext/tvclib/utslvclauxiliary.tsf index 7c0f1df..c21d472 100644 --- a/funcext/tvclib/utslvclauxiliary.tsf +++ b/funcext/tvclib/utslvclauxiliary.tsf @@ -2293,6 +2293,141 @@ type tcountlocker = class() // private fkernel; end +//////////////////////字符串文件读取累////////////////////////////////// +type tfileer_rwraw = class() //字符串文件类型 +{** + @explan(说明)字符串文件类型,load save,local_changed_check,data %% +**} + function create(); + begin + ffilename := ""; + fAlias := ""; + fdatachanged := false; + inputchanged(); + end + function load();//加载 + begin + if not(ifstring(ffilename) and fileexists("",ffilename)) then return 0; //文件名不存在 + p := 0; + len := filesize(fAlias,ffilename); + tm := filetime(fAlias,ffilename); + if not fdatachanged then //对象数据修改了 + begin + if (len=flen) and (tm=floadtime) then return 1; //大小时间没变 + end + if 1 = readfile(rwraw(),fAlias,ffilename,p,len,data) then //读文件 + begin + fdata := data; + flen := len; + floadtime := tm; + floaded := true; + fdatachanged := false; + return 1; + end + end + function save(); //保存 + begin + if not(ifstring(ffilename) and ffilename) then return 0; + if fileexists(fAlias,ffilename) then + begin + tm := filetime(fAlias,ffilename); + if tm=floadtime then return 1; + sz := filesize(fAlias,ffilename); + if sz>length(fdata) then + begin + if filedelete(fAlias,ffilename)<>1 then return 0; + end else + begin + p := 0; + if 1 = readfile(rwraw(),fAlias,ffilename,p,sz,data) then + begin + if fdata=data then + begin + return 1; + end + end + end + end else + begin + exportfile(ftstring(),fAlias,ffilename,""); + end + if 1=writefile(rwraw(),fAlias,ffilename,0,length(fdata),fdata) then + begin + floadtime := filetime(fAlias,ffilename); + flen := length(fdata); + floaded := true; + fdatachanged := false; + return true; + end + return false; + end + function local_changed_check(); //本地文件是否从修改后发生改变 + begin + if floaded then + begin + if fileexists(fAlias,ffilename) then + begin + if floadtime<>filetime(fAlias,ffilename) then + begin + return 1; //改变 + end + end else + begin + return 2; //删除 + end + end + end + property fname read ffilename write setfilename;//文件名 + property Alias read fAlias write fAlias; //目录别名 + property data read getdata write setdata; //数据集 + property ftime read floadtime;// + private + fAlias; + floadtime; + ffilename; + flen; + fdata; + fleadload; + fdatachanged; + private + function getdata(); + begin + return fdata; + end + function setdata(s);//设置数据 + begin + if ifstring(s) and s<>fdata then + begin + inputchanged(); + fdata := s; + fdatachanged := true; + end + end + function setalias(s); + begin + if ifstring(s) and s<>fAlias then + begin + fAlias := s; + inputchanged(); + end + end + function setfilename(f); //修改文件名 + begin + if f<>ffilename then //文件改变 + begin + ffilename := f; + inputchanged(); + end + end + function inputchanged();//输入改变 + begin + fdata := ""; + flen := ""; + floadtime := 0; + floaded := false; + end + +end type tinstancemanager = class() {** @explan(说明)函数c语言指针管理器 %% diff --git a/funcext/tvclib/uwindowsinterface.tsf b/funcext/tvclib/uwindowsinterface.tsf index f339dcf..1f37d4e 100644 --- a/funcext/tvclib/uwindowsinterface.tsf +++ b/funcext/tvclib/uwindowsinterface.tsf @@ -727,10 +727,10 @@ begin begin g_windows_proc_handle := makeinstance(thisfunction(tslvclproc)); end - {try + try SetProcessDpiAwareness(2); //shez dpi感知 except - end } + end end function uninit();//卸载 begin