📄 u_sms.~pas
字号:
unit U_SMS;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, Menus, StdCtrls, ImgList, ExtCtrls, OleCtrls,StrUtils,
DB, ADODB, FileCtrl;
type
TForm1 = class(TForm)
StatusBar1: TStatusBar;
MainMenu1: TMainMenu;
xitong1: TMenuItem;
GroupBox1: TGroupBox;
ListView1: TListView;
Memo1: TMemo;
SaveDialog1: TSaveDialog;
PopupMenu1: TPopupMenu;
N3: TMenuItem;
N4: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N10: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
OpenDialog1: TOpenDialog;
N15: TMenuItem;
N21: TMenuItem;
N22: TMenuItem;
N24: TMenuItem;
N20: TMenuItem;
N25: TMenuItem;
N31: TMenuItem;
Timer1: TTimer;
Timer11: TTimer;
N33: TMenuItem;
N45: TMenuItem;
N19: TMenuItem;
N39: TMenuItem;
N47: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
N23: TMenuItem;
N40: TMenuItem;
N43: TMenuItem;
N44: TMenuItem;
N53: TMenuItem;
N16: TMenuItem;
N32: TMenuItem;
N34: TMenuItem;
N36: TMenuItem;
N52: TMenuItem;
N56: TMenuItem;
N18: TMenuItem;
N29: TMenuItem;
N11: TMenuItem;
N17: TMenuItem;
procedure FormActivate(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ListView1DblClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure N3Click(Sender: TObject);
procedure N11Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N21Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N22Click(Sender: TObject);
procedure N24Click(Sender: TObject);
procedure N25Click(Sender: TObject);
procedure N31Click(Sender: TObject);
procedure ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
procedure Timer1Timer(Sender: TObject);
procedure Timer11Timer(Sender: TObject);
procedure N33Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N39Click(Sender: TObject);
procedure N45Click(Sender: TObject);
procedure N23Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N40Click(Sender: TObject);
procedure N44Click(Sender: TObject);
procedure N53Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure N32Click(Sender: TObject);
procedure N36Click(Sender: TObject);
procedure N52Click(Sender: TObject);
procedure N56Click(Sender: TObject);
procedure N18Click(Sender: TObject);
procedure N29Click(Sender: TObject);
procedure N17Click(Sender: TObject);
procedure Memo1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
procedure show_state(line,row:integer;str:string);
procedure Timer_con(timer:ttimer;istart,iend,tInterval:integer);
procedure Timer_get(timer:ttimer;istart,iend,tInterval:integer);
procedure save_files();
end;
var
Form1: TForm1;
implementation
uses define, setting,comm,help,SHELLAPI,U_dir;
{$R *.dfm}
procedure TForm1.FormActivate(Sender: TObject);
var i:integer;
begin
for i:=0 to max_channel do
with ListView1.Items.Add do
begin
Caption:=inttostr(i+1);
SubItems.add(inttostr(channels[i].channel_COM));
if channels[i].channel_state=0 then
SubItems.add('停用');
SubItems.add('');
SubItems.add('');
SubItems.add(inttostr(channels[i].sucess_count));
SubItems.add(inttostr(channels[i].false_count));
SubItems.add(channels[i].now_send_no);
SubItems.add('');
SubItems.add('');
SubItems.add('');
SubItems.add('');
// SubItems.add(inttostr(channels[i].speed));
// SubItems.add('');
end;
if zc(ypxlh,zcm,yxq,xym) then
begin
StatusBar1.Panels.Items[0].Text:='已注册';
yxq:=inttostr(strtoint(yxq)-1);
xym:=inttostr(strtoint(yxq) mod 7);
save_inifile('config.ini','com0','set2',zcm+yxq+xym);
n24.Visible:=false;
timer1.Enabled:=true;
end
else
begin
StatusBar1.Panels.Items[0].Text:='未注册';
showmessage('请输入注册码否则将无法正常发送');
N24.Click;
end;
end;
procedure TForm1.ToolButton2Click(Sender: TObject);
begin
if ListView1.ItemIndex>0 then
begin
ListView1.Items.Item[ListView1.ItemIndex].Caption:='序号' ;
ListView1.Items.Item[ListView1.ItemIndex].SubItems.Add('端口');
ListView1.Items.Item[ListView1.ItemIndex].SubItems.Strings[4]:='44';
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
VAR i_line:INTEGER;
no_path_temp,cacs_temp:string;
begin
ypxlh:=str_md5(trim(GetIdeSerialNumber),'xyxuyong');
for i_line:=0 to max_channel do
begin
config[i_line].config_list:=TStringList.Create;
config[i_line].config_list:=Read_inifile('config.ini','com'+inttostr(i_line),'set',12);
//showmessage(config[0].config_list.Text);
end;
all_no_list:=TStringList.Create;
write_read_timeout:=TStringList.Create;
read_all_msg:=TStringList.Create;
sstarttime:=formatdatetime('yyyy-mm-dd hh:mm:ss',now());
StatusBar1.Panels.Items[1].Text:='启动时间:'+sstarttime;
no_path_temp:=ExtractFilePath(Application.ExeName);
form1.Caption:=no_path_temp+form1.Caption;
if get_file_size(no_path_temp+'last.txt')>0 then
all_no_list:=inport_no(no_path_temp+'last.txt');
init_channels(0,max_channel);
memo1.Clear;
end;
procedure TForm1.ListView1DblClick(Sender: TObject);
begin
if listview1.ItemIndex>-1 then
LoadForm(listview1.ItemIndex);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
VAR I:INTEGER;
begin
if Messagebox(Handle,'你确定退出该系统吗?','提示',MB_YESNO+MB_ICONQUESTION+MB_DEFBUTTON2)=IDYES then
begin
Action := caFree ;
for i:=0 to max_channel do
BEGIN
config[i].config_list.Destroy;
channels[i].recv_sms_id.Destroy;
end;
save_files();
all_no_list.SaveToFile(ExtractFilePath(Application.ExeName)+'last.txt');
all_no_list.Destroy;
write_read_timeout.Destroy;
read_all_msg.Destroy;
end
else
Action := caNone
end;
procedure TForm1.show_state(line,row:integer;str:string);
begin
ListView1.Items.Item[line].SubItems.Strings[row]:=str;
end;
procedure TForm1.N3Click(Sender: TObject);
var i:integer;
begin
i:=listview1.ItemIndex;
if i>-1 then
begin
show_state(i,3,'');
show_state(i,4,'0');
show_state(i,5,'0');
show_state(i,6,'');
show_state(i,7,'');
show_state(i,8,'');
show_state(i,9,'');
channels[i].false_count:=0;
channels[i].sucess_count:=0;
end;
end;
procedure TForm1.N11Click(Sender: TObject);
begin
if n11.Checked then
n11.Checked:=false
else
n11.Checked:=true;
end;
procedure TForm1.N14Click(Sender: TObject);
var path_str,log_namet:string;
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
all_no_list:=inport_no(path_str);
// showmessage(all_no_list.Text);
save_inifile('config.ini','com0','set4',path_str);
no_path:=path_str;
if all_no_list.Count>0 then
begin
log_namet:=(ExtractFileName(OpenDialog1.FileName));//获取文件名
log_namet:=copy(log_namet,1,pos('.',log_namet)-1);
if InputQuery('日记保存名称', '日记名称 ', log_namet) then
log_name:=log_namet ;
end;
end
end;
read_all_msg.Clear;
sstarttime:=formatdatetime('yyyy-mm-dd hh:mm:ss',now());
end;
procedure TForm1.N21Click(Sender: TObject);
var i:integer;
limit_temp:string;
begin
if InputQuery('请输入密码', '密码 ',limit_temp) then
begin
if trim(limit_temp)='' then exit;
for i:=0 to max_channel do
begin
channels[i].qz:='2008#'+trim(limit_temp);
save_inifile('config.ini','com'+inttostr(i),'set5','2008#'+trim(limit_temp));
end;
end;
end;
procedure TForm1.N7Click(Sender: TObject);
var i:integer;
begin
N7.Enabled:=false;
for i:=0 to max_channel do
begin
if (channels[i].channel_state=0) and (ListView1.Items.Item[i].Checked) 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.N8Click(Sender: TObject);
var i:integer;
begin
N44.Enabled:=true;
N7.Enabled:=true;
for i:=0 to max_channel do
begin
if (channels[i].channel_state<>0)then
if colse_port(channels[i].channel_COM)=0 then channels[i].channel_state:=0;
END;
end;
procedure TForm1.N22Click(Sender: TObject);
var
i:integer;
speed_temp:string;
begin
if InputQuery('请输入速度数值', '速度数值(条/小时) ',speed_temp) then
begin
if is_int(speed_temp) then
begin
for i:=0 to max_channel do
begin
channels[i].speed:=strtoint(speed_temp);
save_inifile('config.ini','com'+inttostr(i),'set0',inttostr(channels[i].speed));
end;
end;
end;
end;
procedure TForm1.N24Click(Sender: TObject);
begin
zcm:=trim(InputBox('请输入注册码', '如果还没有注册码,请将下面的代码发送到 QQ:17184788 获取注册码',ypxlh));
if zcm=ypxlh then exit;
yxq:=copy(zcm,33,4);
xym:=copy(zcm,37,1);
zcm:=leftstr(zcm,32);
if zc(ypxlh,zcm,yxq,xym) then
BEGIN
showmessage('注册成功,请重新启动软件!');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -