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

📄 u_sms.~pas

📁 利用手机短信信息实现充值的例子
💻 ~PAS
📖 第 1 页 / 共 3 页
字号:


if not Timer.Enabled then Timer.Enabled:=true;
end;




procedure TForm1.N31Click(Sender: TObject);
var  limit_temp:string;
begin
if InputQuery('请输入号码', '接收号码     ',limit_temp) then
begin
if trim(limit_temp)<>''   then all_no_list.Insert(0,limit_temp);
end;
end;

procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
  Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
 // if ListView1.Items.Item[Item.Index].Checked then
  // begin
 //  ListView1.Canvas.Brush.Color:=RGB(154,207,170);

//   end
 //  else
  if  (channels[Item.Index].false_count>20)and (not ListView1.Items.Item[Item.Index].Checked)    then
  begin
     ListView1.Canvas.Brush.Color:=RGB(250,54,5);
  end
  else
   begin
 case channels[Item.Index].channel_state of
 0:
  begin
    ListView1.Canvas.Brush.Color:=RGB(200,200,200);
  end;
 10,11,33,34:
  begin
    ListView1.Canvas.Brush.Color:=RGB(255,255,0);
  end;
 23:
  begin
   ListView1.Canvas.Brush.Color:=RGB(0,128,255);
  end
 else
   ListView1.Canvas.Brush.Color:=clwhite;

  end;

 end;

  end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer_con(Timer1,0,max_channel,200);
end;

procedure TForm1.Timer11Timer(Sender: TObject);
begin
Timer_get(timer11,0,max_channel,50);
end;

procedure TForm1.N33Click(Sender: TObject);
var i,j:integer;
    mob_temp:string;
begin
j:=listview1.ItemIndex;


if j<0 then
  begin
    if (InputQuery('请输入营业中心号码', '设置全部端口营业中心   ',mob_temp))then
    for i:=0 to max_channel  do
    begin
    channels[i].cz_mobile:= mob_temp;
    save_inifile('config.ini','com'+inttostr(i),'set9',mob_temp);
    end;
  end
else
  begin
  if (InputQuery('请输入营业中心号码', '设置指定端口营业中心   ',mob_temp))then
    begin
    channels[j].cz_mobile:=mob_temp;
    save_inifile('config.ini','com'+inttostr(j),'set9',mob_temp);
    end;
  end;

end;

procedure TForm1.N4Click(Sender: TObject);
begin
if not Timer11.Enabled then Timer11.Enabled:=true;

end;

procedure TForm1.N39Click(Sender: TObject);
var path_str:string;
    no_list_temp:TStringList;
    i:integer;
begin
 if not zc(ypxlh,zcm,yxq,xym)  then  exit;
if OpenDialog1.Execute then
begin
path_str:=OpenDialog1.FileName;
if FileExists(path_str) then
begin
 no_list_temp:=TStringList.Create;
 no_list_temp.Clear;
 no_list_temp:=inport_no(path_str);
 if no_list_temp.Count>0 then
 begin
  for i:=0 to  no_list_temp.Count-1 do
   begin
    all_no_list.Add(no_list_temp.Strings[i])
   end;
end;
  no_list_temp.Clear;
 no_list_temp.Destroy;
end;
end;

end;


procedure TForm1.N45Click(Sender: TObject);
var i,i1,i2:integer;
    limit_temp:string;
    no_list_temp:TStringList;
 begin
  if not zc(ypxlh,zcm,yxq,xym)  then  exit;
  if InputQuery('请输入导出数量', '导出的是未发的最后X个号码     ',limit_temp) then
  begin
    if is_int(limit_temp)then
    begin
      no_list_temp:=TStringList.Create;
      i1:= all_no_list.Count-strtoint(limit_temp);
      if i1>0 then  i2:=strtoint(limit_temp) else   i2:=all_no_list.Count;
      for i:=0 to  i2-1 do
       begin
        no_list_temp.Add(all_no_list.Strings[all_no_list.Count-1]);
        all_no_list.Delete(all_no_list.Count-1);
       end;
    if no_list_temp.Count>0 then
    begin
      if SaveDialog1.Execute then
     begin
      no_list_temp.Insert(0,messagestr);
      no_list_temp.SaveToFile(SaveDialog1.FileName);
     end;
    end;
    no_list_temp.Clear;
    no_list_temp.Destroy;
    end
  

  end;
 end;

procedure TForm1.N23Click(Sender: TObject);
var i:integer;
begin
 i:=listview1.ItemIndex;
if i>-1 then
begin

if (channels[i].channel_state=0) then
  begin
  if open_port(channels[i].channel_COM,channels[i].channel_COM_speed)=0 then
     begin
     if ini_port(channels[i].channel_COM)>0 then channels[i].channel_state:=10;
     end
  end
  else
  begin
   if  colse_port(channels[i].channel_COM)=0 then channels[i].channel_state:=0;
  end;
  end
  else
  begin
    showmessage('请选择端口!!!');
  end;
end;

procedure TForm1.N2Click(Sender: TObject);
begin
if not zc(ypxlh,zcm,yxq,xym)  then  exit;
F_help.ShowModal;
end;

procedure TForm1.N40Click(Sender: TObject);
var i,i1,port_no:integer;
    limit_temp:string;
begin
 i:=listview1.ItemIndex;
 if i<0 then
 begin
  showmessage('请选择开始设备!!!');
  exit;
 end;


 if InputQuery('请输入起始端口号', '起始端口号     ',limit_temp) then
  begin
    if strtoint(limit_temp)<1  then
    begin
     for i1:=i to max_channel do
       begin
       channels[i1].channel_COM:=0;
       save_inifile('config.ini','com'+inttostr(i1),'set7',inttostr(channels[i1].channel_COM));
       end;
    end
    else
       begin
         port_no:=strtoint(limit_temp);
         for i1:=i to max_channel do
         begin
         channels[i1].channel_COM:=port_no;
         save_inifile('config.ini','com'+inttostr(i1),'set7',inttostr(channels[i1].channel_COM));
         inc(port_no);
         end;
      end;
  end;
end;

procedure TForm1.N44Click(Sender: TObject);
var i:integer;
begin
 N44.Enabled:=false;
for i:=0 to  max_channel do
  begin
  if  (channels[i].channel_state=0) then
    begin
     if open_port(channels[i].channel_COM,channels[i].channel_COM_speed)=0 then
     begin
    
      if ini_port(channels[i].channel_COM)>0 then  channels[i].channel_state:=10;
    end;
    end
  end;
end;

procedure TForm1.N53Click(Sender: TObject);
var  limit_temp:string ;
begin
limit_temp:=write_read_timeout.DelimitedText;
if InputQuery('请输入超时(毫秒)', '总写超时,总读超时,读区间超时,速度控制时间,发送等待时间     ',limit_temp) then
begin
 write_read_timeout.DelimitedText:=limit_temp;
 save_inifile('config.ini','com0','set10',limit_temp);
// showmessage('重启后才能生效');
end;
end;

procedure TForm1.N16Click(Sender: TObject);
begin
LoadForm(listview1.ItemIndex);
end;

procedure TForm1.N32Click(Sender: TObject);
begin
if Messagebox(Handle,'清空 待发号码 将无法恢复,确定?','提示',MB_YESNO+MB_ICONQUESTION+MB_DEFBUTTON2)=IDYES then
   begin
      all_no_list.Clear;
      all_no_list.SaveToFile(ExtractFilePath(Application.ExeName)+'last.txt');
   end;
end;

procedure TForm1.N36Click(Sender: TObject);

var  limit_temp:string;
i:integer;
 begin
  if InputQuery('请输入号码', '手机号码      ',limit_temp) then
  begin
    if trim(limit_temp)=''  then exit;
     i:= all_no_list.IndexOf(trim(limit_temp));
     if i>-1 then
      begin
     if Messagebox(Handle,pchar('是否删除号码:'+limit_temp+',号码位置:'+inttostr(i)),'提示',MB_YESNO+MB_ICONQUESTION+MB_DEFBUTTON2)=IDYES then   all_no_list.Delete(all_no_list.IndexOf(trim(limit_temp)));
     end
     else
      showmessage('无此号码!')
    end;
 end;

procedure TForm1.N52Click(Sender: TObject);
begin
ShellExecute(handle,'open',pchar(ExtractFilePath(Application.ExeName)+'config.ini'),nil,nil,SW_ShowNormal);

end;

procedure TForm1.N56Click(Sender: TObject);
var i,i1,port_no:integer;
    limit_temp:string;
begin
 i:=listview1.ItemIndex;
 if i<0 then
 begin
  showmessage('请选择开始设备!!!');
  exit;
 end;


 if InputQuery('请输入起始端口号', '起始端口号     ',limit_temp) then
  begin
    if strtoint(limit_temp)<1  then
    begin
     for i1:=i to max_channel do
       begin
       channels[i1].channel_COM:=0;
       save_inifile('config.ini','com'+inttostr(i1),'set7',inttostr(channels[i1].channel_COM));
       end;
    end
    else
       begin
         port_no:=strtoint(limit_temp);
         for i1:=i to max_channel do
         begin
         channels[i1].channel_COM:=port_no;
         save_inifile('config.ini','com'+inttostr(i1),'set7',inttostr(channels[i1].channel_COM));
         inc(port_no);
         end;
      end;
  end;

end;


procedure TForm1.N18Click(Sender: TObject);
var srp:string;
begin
srp:=log_path+'recvmsg_temp.txt';
if get_file_size(srp)>0 then
ShellExecute(handle,'open',pchar(srp),nil,nil,SW_ShowNormal)
else
showmessage('暂无接收信息') ;

end;

procedure TForm1.N29Click(Sender: TObject);
begin
ShellExecute(handle,'open',pchar(ExtractFilePath(Application.ExeName)+'cscamobile.txt'),nil,nil,SW_ShowNormal);
end;

procedure TForm1.save_files();
var no_path_temp:string;
begin

if   read_all_msg.Count>0then
begin
no_path_temp:=log_path+'recvmsg_'+log_name+'_'+formatdatetime('yyyymmddhhmmss',now())+'.txt';
read_all_msg.SaveToFile(no_path_temp);
read_all_msg.Clear;
end;
no_path_temp:=log_path+'recvmsg_temp.txt';
 if FileExists(no_path_temp)   then  DeleteFile(no_path_temp);

end;

procedure TForm1.N17Click(Sender: TObject);
begin
f_dir.ShowModal;
end;

procedure TForm1.Memo1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
Memo1.Hint:='目前行数:'+inttostr(Memo1.Lines.Count);
end;

end.

⌨️ 快捷键说明

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