home *** CD-ROM | disk | FTP | other *** search
/ Solo Programadores 22 / SOLO_22.iso / packages / win32ada / data.z / GDIDEMO.ADB < prev    next >
Encoding:
Text File  |  1995-12-05  |  2.7 KB  |  79 lines

  1. -- $Source: /home/harp/1/proto/monoBANK/winnt/gdidemo.adb,v $ 
  2. -- $Revision: 1.1 $ $Date: 95/02/11 13:50:05 $ $Author: mg $ 
  3. -- $Id: gdidemo.adb 1.2 1995/01/25 15:53:29 teg Exp teg $
  4. --
  5. --  procedure Gdidemo body 
  6. --
  7. --  This package body is a loose translation of the WinMain function in 
  8. --  gdidemo.c.  This procedure does the initial application initialization
  9. --  and contains the message loop. 
  10.  
  11.  
  12. pragma Linker_Options("-lwin32ada");
  13.  
  14.  
  15. with Win32;
  16. with Win32.WinDef;
  17. with Win32.WinUser;
  18. with Win32.WinMain;
  19. with Init; 
  20.  
  21. procedure Gdidemo is
  22.  
  23.   use type System.Address;
  24.   use type Interfaces.C.Int;
  25.   use type Win32.BOOL;
  26.  
  27.   hWndFrame  : Win32.WinDef.HWND;
  28.   msg_p      : Win32.WinUser.LPMSG;
  29.   hInst      : Win32.WinDef.HINSTANCE;
  30.   bResult    : Win32.BOOL;
  31.   longResult : Win32.LONG;
  32.  
  33. begin
  34.   -- Get the instance for this application
  35.   hInst := Win32.WinMain.Get_hInstance;
  36.  
  37.   --  /*
  38.   --  ** If there's a previous instance of this application, then we do not need
  39.   --  ** to register it again.
  40.   --  */
  41.   if Win32.WinMain.Get_hPrevInstance = System.Null_Address then 
  42.     if Init.RegisterAppClass (hInst) = Win32.FALSE then
  43.       return;
  44.     end if;
  45.   end if;
  46.  
  47.   hWndFrame := Init.CreateAppWindow (hInst);
  48.   bResult := Win32.WinUser.ShowWindow (hWndFrame, Win32.WinMain.Get_nCmdShow);
  49.   bResult := Win32.WinUser.UpdateWindow (hWndFrame);
  50.  
  51.   msg_p := new Win32.WinUser.MSG;
  52.   while (Win32.WinUser.GetMessage (msg_p,System.Null_Address,0,0)
  53.                 /= Win32.FALSE) loop
  54.     bResult := Win32.WinUser.TranslateMessage(Win32.WinUser.ac_MSG_t(msg_p));
  55.     longResult := Win32.WinUser.DispatchMessage(Win32.WinUser.ac_MSG_t(msg_p));
  56.   end loop;
  57.  
  58.   Init.UnregisterAppClass(hInst);
  59.  
  60. -------------------------------------------------------------------------------
  61. --
  62. -- THIS FILE AND ANY ASSOCIATED DOCUMENTATION IS PROVIDED "AS IS" WITHOUT 
  63. -- WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT 
  64. -- LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR 
  65. -- A PARTICULAR PURPOSE.  The user assumes the entire risk as to the accuracy 
  66. -- and the use of this file.  This file may be used only by licensees of 
  67. -- Microsoft Corporation's WIN32 Software Development Kit in accordance with 
  68. -- the terms of the licensee's End-User License Agreement for Microsoft 
  69. -- Software for the WIN32 Development Kit.
  70. --
  71. -- Copyright (c) Intermetrics, Inc. 1995
  72. -- Portions (c) 1985-1994 Microsoft Corporation with permission.
  73. -- Microsoft is a registered trademark and Windows and Windows NT are 
  74. -- trademarks of Microsoft Corporation.
  75. --
  76. -------------------------------------------------------------------------------
  77.  
  78. end Gdidemo;
  79.