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

📄 unit1.~pas

📁 Of the password is: Server: "1." Client: + for the month of the date of the machine. Such as
💻 ~PAS
📖 第 1 页 / 共 4 页
字号:
      end;
     label1.Caption:=inttostr(pass);
     end;
     end;


   Allow :=5; //试用期为5天
   Reg_tag := False; //软件是否到注册期
   registerTemp := TRegistry.Create; //准备使用注册表
   with registerTemp do
   begin
     RootKey := HKEY_LOCAL_MACHINE; //存放
    if OpenKey('Software\Microsoft\Windows\CurrentSowft\tag', True) then // 建一目录,存放标志值
    begin
    if ValueExists('DateTag') then begin //用DateTag的值作为标志
       Reg_id := ReadDate('DateTag'); //读出标志值
    if (Reg_id <> 0) and (Now - Reg_id > Allow) then //允许使用的时间到
     Reg_tag := True;
     end else
     WriteDateTime('DateTag', Now); //建立标志,并置初始标志值。
     end;

     if not ValueExists('bbTag') then begin //用DateTag的值作为标志
     Writeinteger('bbTag',0);
     end;

     Reg_id := ReadDate('DateTag');//读出标志值
     Reg_ic := Readinteger('bbTag');//读出标志值
     DecodeDate(now, Year, Month, Day);
     A1:=year*365;
     A2:=month*30;
     A3:=day;
     DecodeDate(Reg_id, Year, Month, Day);
     B1:=year*365;
     B2:=month*30;
     B3:=day;

     if Reg_ic<=5 then
     Writeinteger('bbTag', A1+A2+A3-B1-B2-B3);

     Reg_id := ReadDate('DateTag');//读出标志值
     Reg_ic := Readinteger('bbTag'); //读出标志值
     if (Reg_ic>5) and (Reg_id<>0) then begin
     form1.n27.Enabled:=false;
     end;
     if (Reg_ic>5) and (Reg_id=0) then begin
     form1.n27.Enabled:=true;
     end;
     if (Reg_ic<=5) and (Reg_id<>0) then begin
     form1.n27.Enabled:=true;
     end;
     if (Reg_ic<=5) and (Reg_id=0) then begin
     form1.n27.Enabled:=true;
     end;

     
     mypath:=extractfilepath(paramstr(0));
     reg:=Tregistry.create;
     reg.rootkey:=HKEY_LOCAL_MACHINE;
     if reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run',true) then
     begin
     if not ValueExists('cqdl') then begin
     reg.WriteString('cqdl',mypath+'cqdl.exe');
     Reg.Free; //释放变量
     end;
     end;




   //以下是建立任务栏图标
 myicon.cbSize:=sizeof(TNotifyicondata);
 myicon.Wnd:=handle;
 myicon.uID:=1;
 myicon.uFlags:=nif_message or nif_tip or nif_icon;
 myicon.uCallbackMessage:=wm_icb;
 myicon.hIcon:=application.Icon.Handle;
 myicon.szTip:='13696219309 万能软件科技';
 shell_notifyicon(nim_add,@myicon);
   //以上是建立任务栏图标


  //运行就隐藏窗口
  application.CreateHandle;
  showwindow(application.Handle,SW_HIDE);
  application.ShowMainForm:=false;

end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
BmpStream.Free;
RsltStream.Free;
TmpStream.Free;
shell_notifyicon(nim_delete,@myicon);
end;

procedure TForm1.N4Click(Sender: TObject);
begin
close;  //退出
end;

procedure TForm1.N9Click(Sender: TObject);
 var
 supi1,supi2:string;
begin
        if lv1.SelCount=0 then exit; //没有焦点退出
        fxx('sdesk',lv1.Selected.SubItems[12]);//解锁电脑

        supi1:='update temp set 标志="√" where IP="'+lv1.Selected.SubItems[12]+'"';
        supi2:=tb1.SQL.Text;
        tb1.Close;
        tb1.SQL.Clear;
        tb1.SQL.Add(supi1);
        tb1.Prepared;
        tb1.ExecSQL;

        tb1.Close;
        tb1.SQL.Clear;
        tb1.SQL.Add(supi2);
        tb1.Prepared;
        tb1.Open;
        lv1_create_date;



end;

procedure TForm1.N10Click(Sender: TObject);
  var
  supi1,supi2:string;
begin
        if lv1.SelCount=0 then exit; //没有焦点退出
        fxx('hdesk',lv1.Selected.SubItems[12]); //锁定电脑

        supi1:='update temp set 标志="×" where IP="'+lv1.Selected.SubItems[12]+'"';
        supi2:=tb1.SQL.Text;
        tb1.Close;
        tb1.SQL.Clear;
        tb1.SQL.Add(supi1);
        tb1.Prepared;
        tb1.ExecSQL;

        tb1.Close;
        tb1.SQL.Clear;
        tb1.SQL.Add(supi2);
        tb1.Prepared;
        tb1.Open;
        lv1_create_date;

end;

procedure TForm1.N12Click(Sender: TObject);
begin
if lv1.SelCount=0 then exit; //没有焦点退出
 fxx('close',lv1.Selected.SubItems[12]);    //关机
end;


//侦消息函数
procedure TForm1.CUDPDataReceived(Sender: TComponent; NumberBytes: Integer;
  FromIP: String; Port: Integer);
var
  CtrlCode:array[0..250] of char;
  ipdz,sfnj1,sfnj2:string;
  js :integer;
  cudp1,cudp2,cudp3,cudp4,cudp5,cudp6:string;//本函数的公用变量
begin
  ipdz:='';
  js:=0;
  CUDP.ReadBuffer(CtrlCode,NumberBytes);
  // 读取控制码
  if CtrlCode[0]+CtrlCode[1]='mz' then //客机发来客机的计算机名
   jsjm:=CtrlCode[2]+CtrlCode[3]+CtrlCode[4]+CtrlCode[5]+CtrlCode[6]+CtrlCode[7]+CtrlCode[8]+CtrlCode[9];
  if CtrlCode[0]+CtrlCode[1]='ip' then  //客机发来客机的IP
   begin
 //  取IP地址时登录数据库
    ipdz:=CtrlCode;
    delete(ipdz,1,2);
    with table1 do
    begin //修改库
       first;
       edit;
       while not eof do
       begin
        if table1a1.Value=jsjm then
         begin
         table1.Edit;
         table1ip.Value:=ipdz;
         table1.post;
         cudp4:=table1a15.Value;
         js:=1;
         end;
        next;
       end;
    if js=0 then
      begin    //js=0            //在库中没有添加
        table1.Append;
        table1a1.Value:=jsjm;
        table1a0.Value:='⊙';  //状态为联机
        table1ip.Value:=ipdz;
        table1a15.Value:='×'; //标志为锁屏
        cudp4:=table1a15.Value;
        post;
        tb1.Close;
        tb1.Open;
        lv1_create_date;
      end;     //js=0
    end;   //修改库
    fxx('zjip'+NMDayTime1.LocalIP,ipdz); //把主机IP发过去
    if cudp4='√' then fxx('sdesk',ipdz);   //如果标志是正在使用中则解锁

  end;   //取IP地址时登录数据库

  if CtrlCode[0]+CtrlCode[1]+CtrlCode[2]+CtrlCode[3]='sfnj' then
      //是否还在线上  联机
        begin
        sfnj2:=CtrlCode;
        delete(sfnj2,1,5);
        if CtrlCode[4]='1' then
        sfnj2:='update temp set 状态="●" where IP="'+sfnj2+'"' //上机
        else
        sfnj2:='update temp set 状态="⊙" where IP="'+sfnj2+'"';

        sfnj1:=tb1.SQL.Text;
        tb1.Close;
        tb1.SQL.Clear;
        tb1.SQL.Add(sfnj2);
        tb1.Prepared;
        tb1.ExecSQL;

        tb1.Close;
        tb1.SQL.Clear;
        tb1.SQL.Add(sfnj1);
        tb1.Prepared;
        tb1.Open;
        lv1_create_date;
        end;
  if CtrlCode[0]+CtrlCode[1]+CtrlCode[2]+CtrlCode[3]='wyys' then
    begin   //客机查时间
    ipdz:=CtrlCode;
    delete(ipdz,1,4);

    sfnj1:=tb1.SQL.Text;  //保存上次SQL的操作
    sfnj2:='select * from temp  where ip="'+ipdz+'"';
    tb1.Close;
    tb1.SQL.Clear;
    tb1.SQL.Add(sfnj2);
    tb1.Prepared;
    tb1.Open;
    tb1.First;
    cudp1:=timetostr(tb1a4.Value);
    cudp1:=datetostr(tb1a3.Value)+' 日 '+cudp1;


    cudp2:=floattostr(trunc(tb1a9.Value/60))+' 小时 '+floattostr(tb1a9.AsInteger mod 60)+' 分钟';
//    delete(cudp2,5,3);
    cudp3:=timetostr(now);
    cudp5:=floattostr(trunc(tb1a12.Value/60))+' 小时 '+floattostr(tb1a12.AsInteger mod 60)+' 分钟';
    cudp6:=floattostr(tb1a11.Value);
    tb1.SQL.Clear;     //还原上次状态
    tb1.SQL.Add(sfnj1);
    tb1.Prepared;
    tb1.Open;

    sfnj2:='上机时间:'+cudp1+#10#13#10#13+'当前时间:'+datetostr(date)+' 日 '+cudp3+#10#13#10#13+'已用时间:'+cudp2+#10#13#10#13+'剩余时间:'+cudp5+#10#13#10#13+'余    额:'+cudp6+' 元';

    fxx('xx'+sfnj2,ipdz);
    end;

  if CtrlCode[0]+CtrlCode[1]+CtrlCode[2]+CtrlCode[3]='yhdl' then
    begin  //00   收到会员登录
    cudp1:=CtrlCode;
    delete(cudp1,1,4); //去掉控制码
    cudp2:=cudp1;
    delete(cudp2,18,250);  //分离客户机IP
    delete(cudp1,1,18);    //分离客户机发来的帐号+密码
    cudp1:=trimleft(cudp1); //去掉前部空格 IP 与帐号密码是用空格划开的
    cudp2:=trimright(cudp2); //去掉尾部空格
    table3.Active:=true;
    table3.First;
      while not table3.Eof do
        begin   //11111
         if (cudp1=table3a1.Value+table3a2.Value)and (table3a5.Value<>0) then
            begin  //22

                 // 有无重复登录
                  table1.Filtered:=false;
                  table1.Filter:='卡号='+''''+table3a1.Value+'''';
                  table1.Filtered:=true;
                   if table1.RecordCount>0 then begin fxx('chjd',cudp2);exit; end;
                  table1.Filtered:=false;
                 //----无重登录
             fxx('sdesk',cudp2);   //帐号和密码正确 则开锁
             hydl(cudp2,table3a1.Value,table3a3.Value,table3a6.Value,table3a5.Value,table3a9.Value);


             table1.Last; //找到指针移到最后一条记录,即退出查找
             table3.Next;
            end     //22
         else
          table3.Next;
        end; //111111

    table3.Active:=false;
    end;   //00
  if CtrlCode[0]+CtrlCode[1]+CtrlCode[2]+CtrlCode[3]='hyxj' then
     begin
     //会员下机
      cudp5:=CtrlCode;
      delete(cudp5,1,4);
      hyjz(cudp5);
     end;

if CtrlCode[0]+CtrlCode[1]='xx' then
  //收到发来的信息
  begin
  cudp5:=CtrlCode;
    delete(cudp5,1,2); //去掉控制码
 Application.MessageBox(Pchar(cudp5),'信息',MB_OK);
  end;

if CtrlCode[0]+CtrlCode[1]='xy' then
  //收到发来的信息
  begin
  cudp5:=CtrlCode;
    delete(cudp5,1,2); //去掉控制码
  end;



  if CtrlCode[0]+CtrlCode[1]+CtrlCode[2]+CtrlCode[3]='proc' then
//发来进程数据
begin
    cudp6:=CtrlCode;
    delete(cudp6,1,4);
    proc.listbox1.Items.Add(cudp6);
    proc.ListBox1.Refresh;

   end;
  end;    //侦消息函数

procedure TForm1.N13Click(Sender: TObject);
//删除本行
var
 dele1,str,str1:string;
begin
  if lv1.SelCount=0 then exit; //没有焦点退出
  //防止在无选择空记录上
  dele1:=lv1.Selected.Caption; //取关健字
  //删除SQL语句
  str:='delete from temp where 电脑="'+dele1+'"';
  str1:=tb1.SQL.Text;
  tb1.Close;
  tb1.SQL.Clear;
  tb1.SQL.Add(str);
  tb1.Prepared;
  tb1.ExecSQL;
  //刷新listvice(lv1)
  tb1.SQL.Clear;
  tb1.SQL.Add(str1);
  tb1.Prepared;
  tb1.Open;
  lv1_create_date;
end;

procedure TForm1.N7Click(Sender: TObject);
var
 aboutf:tkahao;      //添加临时卡
begin

if lv1.SelCount<>0 then
 begin
  if lv1.Selected.SubItems[3]<>'' then
//已上机 转到结帐
  begin
  Form1.N11Click(Sender);
  exit;
  end;
 aboutf:=tkahao.Create(self);
 aboutf.ShowModal;
 table1.Refresh;
 end;
end;

procedure TForm1.N15Click(Sender: TObject);
var
  xinxi:string;
begin
 if lv1.SelCount=0 then exit; //没有焦点退出
 xinxi:=inputbox('请输入要发送的信息','信息','');
 if xinxi<>'' then
  begin
  fxx('xx'+xinxi,lv1.Selected.SubItems[12]);
  end;
end;

procedure TForm1.N8Click(Sender: TObject);
var
 aboutf:tjaqang;
 n8c1:string;
begin
if lv1.SelCount<>0 then
  begin
  n8c1:=lv1.Selected.SubItems[3];
  delete(n8c1,3,12);
  if n8c1<>'L-' then
  begin
  showmessage('    会 员'+#10#13+#10#13+'请在会员管理中加钱');
  exit;
  end;
  aboutf:=tjaqang.Create(self);
  aboutf.ShowModal;
  table1.Refresh;  //
  end;
end;

procedure TForm1.N14Click(Sender: TObject);
begin     //刷新
   jlsx(1);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if sizong>3 then   //每半分钟刷新一次 时钟器是10秒一次
   begin
   jlsx(0); //计录刷新过程
    if datetostr(form1.table1a4.Value)='' then
    form1.table1a5.Value:='';
    sizong:=0;
    end

else
   inc(sizong);
end;

procedure TForm1.N11Click(Sender: TObject);
   //结帐
var
 n11c1:array[0..250] of char;
 str,str1,str3:string;
begin

if lv1.SelCount=0 then exit; //如果没有选中记录就退出
if lv1.Selected.SubItems[3]='' then  //如果是空位则添加临时卡
  begin
  Form1.N7Click(Sender);
  exit;
  end;
  str:=lv1.Selected.SubItems[4];
  str1:=lv1.Selected.SubItems[7];
  str3:=lv1.Selected.SubItems[8];
  str3:='要结帐吗?'+#10#13+#10#13+#10#13+'押金:'+str+' 元'+#10#13+#10#13+'费用:'+str1+' 元'+#10#13+#10#13+'应退:'+str3+' 元'+#10#13;
  strpcopy(n11c1,str3);
if application.messagebox(n11c1,'注意',
   mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)<>6 then
   exit;
 fxx('sfnw1'+NMDayTime1.LocalIP,table1ip.Value);
 lkjz(lv1.Selected.SubItems[12]);

end;



procedure TForm1.N6Click(Sender: TObject);
var
 aboutf:tlsjl;      //添加会员
begin
aboutf:=tlsjl.Create(self);
aboutf.ShowModal;
end;

procedure TForm1.N18Click(Sender: TObject);
//远程重启电脑

⌨️ 快捷键说明

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