From: AlexG <agamper@bigpond.net.au>
Subject: Re: [Ann] WinRt - version 3
Date: Sun, 3 Sep 2023 02:07:04 -0700 (PDT) [thread overview]
Message-ID: <98530b20-c270-434c-a5f7-049905d94bf9n@googlegroups.com> (raw)
In-Reply-To: <a8682e62-de20-4954-86da-ed81a81df0c2n@googlegroups.com>
Below is a simple example of the Api usage
--------------------------------------------------------------------------------
with Ada.Wide_Text_IO;
with Ada.Strings.Wide_Unbounded;
with WinRt;
with WinRt.Windows.Foundation;
with WinRt.Windows.Networking;
with WinRt.Windows.Networking.Sockets;
with WinRt.Windows.Storage.Streams;
with WinRt.Windows.Web.Http;
--------------------------------------------------------------------------------
procedure WinRt3Test2 is
use WinRt;
use Ada.Strings.Wide_Unbounded;
Hr : HResult := 0;
function "+"(value : Wide_String) return Unbounded_Wide_String renames To_Unbounded_Wide_String;
function "+"(value : Unbounded_Wide_String) return Wide_String renames To_Wide_String;
begin
Hr := RoInitialize;
if Hr = 0 then
declare
Uri : Windows.Foundation.Uri := Windows.Foundation.Constructor (+"http://www.google.com");
HttpClient : Windows.Web.Http.HttpClient := Windows.Web.Http.Constructor;
Result : WString;
begin
Result := HttpClient.GetStringAsync (Uri);
Ada.Wide_Text_IO.Put_Line (+Result);
HttpClient.Close;
end;
declare
Host : Windows.Networking.HostName := Windows.Networking.Constructor(+"www.google.com");
Port : WString := +"80";
Socket : Windows.Networking.Sockets.StreamSocket := Windows.Networking.Sockets.Constructor;
DataWriter : Windows.Storage.Streams.DataWriter := Windows.Storage.Streams.Constructor (Socket.get_OutputStream);
begin
Socket.ConnectAsync (Host, Port);
Socket.Close;
end;
RoUninitialize;
end if;
end;
prev parent reply other threads:[~2023-09-03 9:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-27 5:18 [Ann] WinRt - version 3 AlexG
2023-09-03 9:07 ` AlexG [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox