wppconnect-team / WPP4Delphi

WPP4Delphi is an open-source project with the aim of exporting functions from WhatsApp Web for Delphi, which can be used to support the creation of any interaction.
Apache License 2.0
187 stars 61 forks source link

Bug: TWPPConnect.IsConnected always return False #65

Closed kayaliabd closed 5 months ago

kayaliabd commented 6 months ago

IsConnected property is always return false even if component connected to WhatsApp

marcelo386 commented 5 months ago

use the same as the code below

if not frDemo.TWPPConnect1.auth then exit;

frDemo.TWPPConnect1.IsOnline;

will return in the component event like this example that is available in the demo version

procedure TfrDemo.TWPPConnect1GetIsOnline(Response: TIsOnline); begin if Response.IsOnline then begin frameMensagensRecebidas1.memo_unReadMessage.Lines.Add('Online');

frameLogin1.lblStatus.Caption := 'Online';
frameLogin1.lblStatus.Font.Color := $0000AE11;
frameLogin1.SpeedButton3.Enabled := True;
frameLogin1.whatsOn.Visible := True;
frameLogin1.whatsOff.Visible := False;
StatusBar1.Panels[1].Text := 'Online';
frameLogin1.imgQrCode.Picture := nil;

end else begin frameMensagensRecebidas1.memo_unReadMessage.Lines.Add('Offline');

frameLogin1.lblStatus.Caption := 'Offline';
frameLogin1.lblStatus.Font.Color := $002894FF;
frameLogin1.lblStatus.Font.Color := clGrayText;
frameLogin1.whatsOff.Visible := True;
frameLogin1.whatsOn.Visible := False;
frameLogin1.SpeedButton3.Enabled := True;
StatusBar1.Panels[1].Text := 'Offline';

end; end;