home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Source / OPMinit.cpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  2KB  |  87 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OPMinit.cpp
  5.  
  6.  
  7. // OPMinit a base class for PM-Applications and threads
  8.  
  9.  
  10. /*
  11.  * Redistribution and use in source and binary forms, with or without
  12.  * modification, are permitted provided that the following conditions
  13.  * are met:
  14.  * 1. Redistributions of source code must retain the above copyright
  15.  *    notice, this list of conditions and the following disclaimer.
  16.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  17.  *    endorse or promote products derived from this software
  18.  *    without specific prior written permission.
  19.  * 3. See OCL.INF for a detailed copyright notice.
  20.  *
  21.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  */
  33.  
  34. // $Header: W:/Projects/OCL/Source/rcs/OPMinit.cpp 1.50 1996/08/11 23:49:26 B.STEIN Release $
  35.  
  36. #define __OCL_SOURCE__
  37.  
  38. #define OINCL_OSTRING
  39. #define OINCL_BASE
  40.  
  41. #include <ocl.hpp>
  42. #include <OPMinit.hpp>
  43.  
  44. // constructor inititializes PM
  45.  
  46.  
  47. OPMinit::OPMinit(const ULONG queueSize) 
  48. {
  49.  _hab = WinInitialize(0);
  50.  
  51.  if(_hab)
  52.    _hmq = WinCreateMsgQueue(_hab, queueSize);
  53.  else
  54.    throw OVioException(OCL::error(130), 0);
  55. }
  56.  
  57.  
  58. // destructor terminates PM
  59.  
  60. OPMinit::~OPMinit()
  61. {
  62.  if (_hmq)
  63.    WinDestroyMsgQueue(_hmq);
  64.  if (_hab)
  65.    WinTerminate(_hab);
  66. }
  67.  
  68.  
  69. PSZ OPMinit::isOfType() const
  70.  return("OPMinit"); 
  71. }
  72.  
  73.  
  74. HAB OPMinit::anchor()
  75. {
  76.  return(_hab);
  77. }
  78.  
  79. HMQ OPMinit::mqueue()
  80. {
  81.  return(_hmq);
  82. }
  83.  
  84.  
  85. // end of source
  86.