Hello World (example of MessageBox function)


with win32.WinUser; use win32.WinUser;
with Interfaces.C; use Interfaces.C;
with Ada.Unchecked_Conversion;
with System;

procedure HelloWorld is


   -- Just in case you were wondering, the WinMain function is replaced
   -- with a package called Win32.WinMain (Take a look at win32-winmain.ads
   -- for more information.


   function To_LPCSTR is new Ada.Unchecked_Conversion (System.Address, Win32.LPCSTR);

   Message  : Char_Array := To_C("Hello World!");
   Title    : Char_Array := To_C("Hello Program");
   RetValue : Win32.Int;
   
begin

   RetValue:=MessageBox(System.Null_Address, To_LPCSTR(Message'Address), To_LPCSTR(Title'Address), 0);

end HelloWorld;

Contributed by: David Botton
Contributed on: November 30, 1998
License: Public Domain
Back