lazarus多线程以实现多页面定时打卡的例子

##lazarus多线程以实现多页面定时打卡的例子##

  • lazarus2.2.6版本

步骤

  • 获取窗口句柄,鼠标移动到输入框.
  • 单击鼠标获取输入焦点
  • 利用剪贴板粘贴输入内容
  • 按下回车键,或者点击提交按钮,进行发送.
    备注
  • Win10平台正常运行
  • 利用临界区以保证输入内容正确
  • 线程处理函数传参需要事先定义一个recode类型
program GetWindow1;
uses
  {$ifdef unix}cthreads, {$endif} sysutils, Windows, dateutils, LazUTF8; 
var
  MyCriticalSection: TRTLCriticalSection;
type
  pcom= ^consum_s;
  consum_s = record
    keyno: integer;
    iinterval: integer;
  end;

procedure time_count(interval: integer);
var
  {t1: TDateTime;}
  HH,MM,SS,MS: Word;
  HH2: Word;
begin
  {t1:= now;}

  {WriteLn('current time is [' + FormatDateTime( 'HH:MM:SS', t1) + ']');}
  DecodeTime(Time,HH,MM,SS,MS);
  Writeln (format('current time is [%.2d:%.2d:%.2d]',[HH,MM,SS]));

  if MM + interval >= 60 then
  begin
    if HH + 1 < 24 then
    begin
      HH2:= HH + 1;
      Writeln (format('[%.2d:%.2d:%.2d] would be comming',[HH2,(MM + interval)-60,SS]));
    end
    else
    begin
      HH2:= 0;
      Writeln (format('[%.2d:%.2d:%.2d] would be comming',[HH2,(MM + interval)-60,SS]));
    end;
  end
  else
    Writeln (format('[%.2d:%.2d:%.2d] would be comming',[HH,MM+interval,SS]));
  Writeln();
end;

procedure mykey_press_release(keyno: integer);
begin
  if keyno = 1 then
  begin
    keybd_event(VK_CONTROL, 0, 0, 0)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值