代码拉取完成,页面将自动刷新
unit backend;
interface
uses
Classes;
type
LoginThread = class(TThread)
private
returnMessage:string;
protected
procedure Execute; override;
procedure notice;
end;
implementation
uses webapp,main,jpeg,sysutils;
procedure LoginThread.Execute;
var flag:boolean;
jpg:TJpegImage;
wxWeb: TWxWeb;
sucess:boolean;
begin
// flag:=false;
wxWeb:=TWxWeb.Create;
jpg:=TJpegImage.Create;
sucess:=wxWeb.getUUID();
if sucess <> true then
begin
returnMessage:='获取UUID失败';
synchronize(notice);
exit;
end;
sucess:=wxWeb.showQRImage();
if sucess <> true then
begin
returnMessage:='获取二维码失败';
synchronize(notice);
exit;
end;
wxWeb.imagestream.Position:=0;
jpg.LoadFromStream(wxWeb.imagestream);
Form1.image1.Picture.Assign(jpg);
sleep(3000);
repeat
returnMessage:='等待登陆';
flag:= wxWeb.waitForLogin();
if flag = true then
begin
break;
end
until (flag);
sucess:= wxWeb.login();
if sucess <> true then
begin
returnMessage:=' 登陆失败';
synchronize(notice);
exit;
end;
sucess:=wxWeb.wxInit();
if sucess <> true then
begin
returnMessage:=' 初始化微信失败';
synchronize(notice);
exit;
end;
sucess:= wxWeb.wxStatusNotify();
if sucess <> true then
begin
returnMessage:='开启信息通知失败';
synchronize(notice);
exit;
end;
sucess:= wxWeb.wxgetContact();
if sucess <> true then
begin
returnMessage:='获取联系人失败';
synchronize(notice);
exit;
end;
returnMessage:='联系人总数:'+inttoStr(wxweb.MemberCount);
synchronize(notice);
while not Terminated do
begin
sleep(500);
sucess:= wxWeb.syncMessageCheck() ;
returnMessage:=' 信息检测 retcode:='+wxWeb.retcode+' retcode:='+wxWeb.selector;
synchronize(notice);
if sucess <> true then
begin
returnMessage:=' 轮训信息失败 retcode:='+wxWeb.retcode+' selector:='+wxWeb.selector;
synchronize(notice);
if (wxWeb.retcode = '1101') or (wxWeb.retcode= '1100') then
break;
end;
sucess:=wxWeb.syncMessageGet();
if sucess <> true then
begin
returnMessage:=' 获取消息失败';
synchronize(notice);
end;
continue;
end;
{ Place thread code here }
end;
procedure LoginThread.notice();
begin
Form1.Memo1.Lines.Add(returnMessage);
end;
end.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。