2016年5月

首页2016年5月
31
May
0

报表是否生成中

frxPreview1.PreviewPages.Engine.Running

'结帐时间' + [cdsCheckOut."F_DATETIME"] + '接待时间' + [cdsReceive."F_DATETIME"] + '店内时长' + [FORMATDATETIME('hh:mm:ss',(cdsCheckOut."F_DATETIME"-cdsReceive."F_DATETIME"))]

31
May
0

Git SSH Key 生成步骤,合并提交命令

Git SSH Key 生成步骤
$ git config --global user.name "xuhaiyan"
$ git config --global user.email "haiyan.xu.vip@gmail.com"
$ ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”

合并提交命令
git cherry-pick commit-id

31
May
0

防止刷新时闪烁的终极解决办法

{ 防止刷新时闪烁的终极解决办法(对付双缓冲无效时) }
Perform($000B, 0, 0); //锁屏幕 防止闪烁

// 做一些会发生严重闪烁的事情..

//解锁屏幕并重画
Perform($000B, 1, 0);
RedrawWindow(Handle, nil, 0, RDW_FRAME + RDW_INVALIDATE + RDW_ALLCHILDREN + RDW_NOINTERNALPAINT);

31
May
0

浮点运算单位FLOPS

一个 MFLOPS (megaFLOPS) 等于每秒1百万 (=10^6) 次的浮点运算,
一个 GFLOPS (gigaFLOPS) 等于每秒10亿 (=10^9) 次的浮点运算,
一个 TFLOPS (teraFLOPS) 等于每秒1万亿 (=10^12) 次的浮点运算,
一个 PFLOPS (petaFLOPS) 等于每秒1千万亿 (=10^15) 次的浮点运算

31
May
0

检查程序是否运行并重启

use
windows,Winapi.TlHelp32,Winapi.PsAPI,System.SysUtils

function GetProcessPath(ProcessID: DWORD): string;
var

 Hand: THandle;
 ModName: Array[0..Max_Path-1] of Char;
 hMod: HModule;
 n: DWORD;

begin
Result:='';
Hand:=OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ,

                     False,
                     ProcessID);

if Hand>0 then
try

 ENumProcessModules(Hand,@hMod,Sizeof(hMod),n);
 if GetModuleFileNameEx(Hand,hMod,ModName,Sizeof(ModName))>0 then
  // Result:=ExtractFilePath(ModName);//得到路径
   Result:=ModName; //得到路径和文见名

except
end;
end;
function CheckProjectIsRun(aProjectPath:string;var aPID:Cardinal):Boolean;
var
ContinueLoop: BOOL;
SnapshotHandle: THandle;
ProcessEntry32: TProcessEntry32;
begin
Result := False;
SnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
ProcessEntry32.dwSize := SizeOf(ProcessEntry32);
ContinueLoop := Process32First(SnapshotHandle, ProcessEntry32);

while Integer(ContinueLoop) <> 0 do
begin

 if (UpperCase(GetProcessPath(ProcessEntry32.th32ProcessID)) = UpperCase(aProjectPath)) and (aPID<>ProcessEntry32.th32ProcessID) then
 begin
   Result := True;
   aPID:=ProcessEntry32.th32ProcessID;
   Exit;
 end;
 ContinueLoop := Process32Next(SnapshotHandle, ProcessEntry32);

end;
CloseHandle(SnapshotHandle);
end;
var
PID:Cardinal;
if CheckProjectIsRun(Application.ExeName, PID) then
begin

case MessageBox(Application.Handle, '已存在实例,需要重启吗?' + #13#10 + '' + #13#10 + '是:重启  否:关闭', 'warning', MB_YESNO + MB_ICONSTOP + MB_DEFBUTTON2) of
  IDYES:
    begin
      TerminateProcess(OpenProcess(PROCESS_TERMINATE, BOOL(0), PID), 0);
    end;
  IDNO:
    begin
      Exit;
    end;
end;

end;