Delphi XE7组件TetheringManager1发送消息

2022-10-14 10:51:04 作者:admin

本文整理自网络,侵删。

 介绍

本文章介绍了Delphi XE7组件TetheringManager1发送消息,今天对这个组件又进行了研究,并写了一个手机客户端以及PC客户端,通过连接可以通过手机忘PC端发送命令,以前需要写很多行的代码,现在就很简单了。在本论坛有代码例子,不过只是进行连接和验证,今天做了发送消息的代码。

发送消息的代码
procedure TForm1.Button2Click(Sender: TObject);
begin
  //
  TetheringAppProfile1.sendString(TetheringManager1.RemoteProfiles[0],
    'SendMessage', '123');
end;




接受消息的代码
procedure TForm1.TetheringAppProfile1ResourceReceived(const Sender: TObject;
  const AResource: TRemoteResource);
begin
  //
  ListBox3.Items.Add(AResource.ToJsonString);
end;


当然发送也可以发送stream,这样可以发送文件或者图片,这样通过手机可以做控制电脑的程序,后续再多研究研究。

在线咨询 拨打电话