From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:6193:b0:76f:c1c:8697 with SMTP id or19-20020a05620a619300b0076f0c1c8697mr140097qkn.8.1693732025861; Sun, 03 Sep 2023 02:07:05 -0700 (PDT) X-Received: by 2002:a17:90a:fc8a:b0:26b:6df8:eb70 with SMTP id ci10-20020a17090afc8a00b0026b6df8eb70mr1780242pjb.1.1693732025287; Sun, 03 Sep 2023 02:07:05 -0700 (PDT) Path: eternal-september.org!news.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Sep 2023 02:07:04 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=2001:8003:281a:c01:bc6f:e492:284e:bc3; posting-account=rpELHgoAAADyznoDQ9DF8kYwISCaKTaz NNTP-Posting-Host: 2001:8003:281a:c01:bc6f:e492:284e:bc3 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <98530b20-c270-434c-a5f7-049905d94bf9n@googlegroups.com> Subject: Re: [Ann] WinRt - version 3 From: AlexG Injection-Date: Sun, 03 Sep 2023 09:07:05 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 3055 Xref: news.eternal-september.org comp.lang.ada:65583 List-Id: 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;