home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / CFGED1B.ZIP / PMVIEWS.ZIP / SESSION.CC < prev    next >
C/C++ Source or Header  |  1992-07-18  |  3KB  |  110 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2.  
  3. /* session.cc
  4.  *
  5.  * Implementation of class Session
  6.  *
  7.  * This class initiates a new session for a PM program
  8.  *
  9.  * Language        : C++
  10.  * Operating System: OS/2 V2.0 and higher
  11.  * Compiler        : GNU GCC V2.1 and higher
  12.  *
  13.  *
  14.  * $Id: session.cc,v 1.1 1992/07/18 02:02:43 gruen Exp $
  15.  *
  16.  * $Log: session.cc,v $
  17. // Revision 1.1  1992/07/18  02:02:43  gruen
  18. // Initial revision
  19. //
  20.  *
  21.  * Copyright (c) 1992 Lutz Grueneberg
  22.  *
  23.  * This library is free software; you can redistribute it and/or modify
  24.  * it under the terms of the GNU Library General Public License as
  25.  * published by the Free Software Foundation; either version 2 of the
  26.  * License, or (at your option) any later version.  This library is
  27.  * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  28.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  29.  * A PARTICULAR PURPOSE.  See the GNU Library General Public License for
  30.  * more details. You should have received a copy of the GNU Library
  31.  * General Public License along with this library; if not, write to the
  32.  * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  33.  */
  34. #define INCL_WIN
  35. #include <os2.h>
  36. #include "session.h"
  37.  
  38.  
  39. /* Session::Session()
  40.  *
  41.  * Konstruktor der Klasse Session
  42.  *
  43.  * Initializierung des PM und Registration der Applikation
  44.  * Erzeugung einer Message-Queue
  45.  */
  46.  
  47. Session::Session()
  48. {
  49.   hab = WinInitialize (0);
  50.   hmq = WinCreateMsgQueue (hab,           // Anchor Block handle
  51.                0);          // Queue size, use default
  52. }
  53. /* Session::~Session()
  54.  *
  55.  * Destruktor einer Session. 
  56.  * Zerstoert Message-Queue und Achor-Block.
  57.  */
  58. Session::~Session()
  59. {
  60.   WinDestroyMsgQueue( hmq);
  61.   WinTerminate( hab);
  62. }
  63.  
  64.  
  65. /* Session::queryAnchorBlock()
  66.  *
  67.  * Publike Methode zum Auffinden des Anker-Blocks der Session
  68.  */
  69.  
  70. HAB Session::queryAnchorBlock ()
  71. {
  72.   return  hab;
  73. }
  74.  
  75.  
  76. /* Session::queryMsgQueue()
  77.  *
  78.  * Publike Methode zum Auffinden der Message-Queue der Session
  79.  */
  80.  
  81. HMQ Session::queryMsgQueue()
  82. {
  83.   return  hmq;
  84. }
  85.  
  86.  
  87. /* Session::run()
  88.  *
  89.  * Publike Methode zum Start der Anwendung. Hier wird die
  90.  * Message-Loop durchgefuehrt, d.h. die Message-Queue der
  91.  * Session wird abgefragt und die Medlungen an den Dispatcher
  92.  * Weitergegeben.
  93.  */
  94.  
  95. VOID Session::run()
  96. {
  97.  
  98.   while( WinGetMsg( hab,           // Anchor block handle
  99.                     &qmsg,       // Pointer to queue message structure
  100.                     NULL,          // No window message filter
  101.                     0,             // Retrieve all messages
  102.                     0))            // Retrieve all messages
  103.   { WinDispatchMsg( hab,       // Anchor block handle
  104.                     &qmsg);       // structure holding message
  105.   }
  106. }
  107. /* E O F */
  108.  
  109.  
  110.