home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IAPP_
- #define _IAPP_
- /*******************************************************************************
- * FILE NAME: iapp.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * IApplication - class of objects representing OS/2 "executables" *
- * ICurrentApplication - class of the single instance of the "current" *
- * executable *
- * *
- * COPYRIGHT: *
- * (C) Copyright IBM Corporation 1992 *
- * All Rights Reserved *
- * Licensed Materials * Property of IBM *
- * *
- *$Log: I:/ibmclass/ibaseapp/vcs/iapp.hpv $ *
- //
- // Rev 1.4 19 Oct 1992 16:15:00 law
- //Removed excess security classification.
- //
- // Rev 1.3 12 Oct 1992 12:51:12 law
- // Changed per new IBase.
- //
- // Rev 1.2 25 Sep 1992 23:53:48 law
- // Add initializePM() to ctor and terminatePM() to dtor for ICurrentApplication
- //
- // Rev 1.1 25 Sep 1992 22:09:52 law
- // Major revision
- *******************************************************************************/
- #ifndef _IBASE_
- #include <ibase.hpp>
- #endif
-
- #ifndef _IHANDLE_
- #include <ihandle.hpp>
- #endif
-
- class IResourceLibrary;
- #if !defined( _IRESLIB_ ) && !defined( I_NO_RELATED_HPP )
- #include <ireslib.hpp>
- #endif
-
- class ICurrentApplication;
-
- class IApplication : public virtual IBase {
- /*******************************************************************************
- * Objects of this class represent OS/2 executables. Such objects are used to *
- * launch child processes/applications/session. *
- * *
- * Currently, support is not provided for any of the OS/2 or PM session APIs. *
- * At some point, support will be added for the following system APIs, plus *
- * others to be determined: *
- * DosExecPgm *
- * DosWaitChild *
- * DosKillProcess *
- * DosExit *
- * DosStartSession *
- * DosSelectSession *
- * DosSetSession *
- * DosStopSession *
- * WinStartApp *
- * WinTerminateApp *
- *******************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are n ways to construct instances of this class: |
- | 1. For applicatoin with given program name and arguments (default) |
- | Constructs a new IApplication object that will be subsequently started |
- | via a call to IApplication::start. Both arguments default to null. |
- | 2. For a previously started application with a given PID. |
- | Used to apply IApplication functionality to processes startd via native |
- | OS/2 APIs. |
- ------------------------------------------------------------------------------*/
- IApplication ( const char *progName = 0,
- const char *args = 0 );
- IApplication ( IProcessID pid );
-
- virtual
- ~IApplication ( );
-
- /*-------------------------------- ACCESSORS -----------------------------------
- | These function provide means of getting and setting the accessible |
- | attributes of instances of this class: |
- | id - returns the object's "process id" value |
- | current - reference to the "current" process |
- ------------------------------------------------------------------------------*/
- virtual IProcessID
- id ( ) const;
-
- static ICurrentApplication
- ¤t;
-
- protected:
-
- private:
- /*--------------------------------- PRIVATE ----------------------------------*/
- IProcessID
- pid;
- }; // IApplication
-
- class ICurrentApplication : public IApplication {
- /*******************************************************************************
- * Objects of this class represent the "current" OS/2 executing program. *
- * *
- * There is a single instance of this class. A reference to it is obtained via *
- * the static member IApplication::current. *
- * *
- * The instance of this class contains information that must be maintained on *
- * a per-application basis and must be accessible to code (objects) executing *
- * in the process. *
- *******************************************************************************/
- public:
- /*-------------------------------- ACCESSORS -----------------------------------
- | These function provide means for getting and setting the accessible |
- | attributes of instances of this class: |
- | resourceLib - obtains a reference to the default resource library for |
- | this application |
- | setResourceLib - sets the resource library from which default application |
- | resources will be obtained; this library can be specified |
- | directly, or implicitly via codepage/resource .dll name |
- | argc - obtains the number of application arguments |
- | argv - obtains the n-th argument to the application |
- | setArgs - sets the program arguments (argc/argv from main()) |
- ------------------------------------------------------------------------------*/
- virtual IResourceLibrary
- &resourceLib ( ) const,
- &setResourceLib ( const char *resLibName );
-
- virtual int
- argc ( ) const;
-
- virtual const char
- *argv ( int argNo ) const;
-
- virtual void
- setArgs ( int argc,
- char *argv[] );
-
- /*---------------------------- STARTING/STOPPING -------------------------------
- | These functions provide support for executing and terminating the current |
- | process: |
- | run - initiate the processing of PM messages in the current process |
- | exit - terminate the current process |
- ------------------------------------------------------------------------------*/
- virtual void
- run ( ),
- exit ( );
-
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | The desstructor for the "current process" cleans up application state. |
- ------------------------------------------------------------------------------*/
- ~ICurrentApplication ( );
-
- protected:
- friend class IApplication;
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | The constructor for this class is protected to ensure that the static |
- | member "current" is the only instance. |
- ------------------------------------------------------------------------------*/
- ICurrentApplication ( );
-
- /*----------------------------- IMPLEMENTATION ---------------------------------
- | These function are used to implement this class: |
- | currentPID - static function returning current process ID |
- ------------------------------------------------------------------------------*/
- static IProcessID
- currentPID ( );
-
- private:
- /*--------------------------------- PRIVATE ----------------------------------*/
- IResourceLibrary
- *resLib;
- static ICurrentApplication
- current;
- }; // ICurrentAppliction
-
- #endif /* _IAPP_ */