### ICurrentApplication

  The ICurrentApplication class represents the program that is currently running. You are limited to a single object of this class. To obtain a reference to the object, use the static function IApplication::current. The object of this class contains information that the Open Class Library maintains for each running application.

### ICurrentApplication - Member Functions and Data by Group

### Constructors & Destructor

The constructors of this class are protected to ensure that the static function IApplication::current returns the correct reference to the only object of this class. Also, the destructor is protected.

~ICurrentApplication

      protected:
      virtual ~ICurrentApplication()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

ICurrentApplication

      protected:
      ICurrentApplication()

  You can only construct objects of this class with the default constructor, which does not require any arguments.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Arguments

Use these members to access or set the program arguments that can be passed to a program when it is executed.

argc

      public:
      virtual int argc() const

  Obtains the number of application arguments.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

argv

      public:
      virtual IString argv(int argumentNumber) const

  Obtains the specified argument that is passed to the application.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setArgs

      public:
      virtual ICurrentApplication&
        setArgs( int argc,
                 const char * const argv [ ] )

  Sets the program arguments. Call this member function from your application's main function, passing its argc and argv argument values.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Color Map Support

Use these members to set and query the color map used by your application.

adoptColorMap

      public:
      virtual ICurrentApplication&
        adoptColorMap( IColorMap* colorMap )

  Establishes the application-wide color palette used in all drawing operations.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

colorMap

      public:
      virtual IColorMap& colorMap() const

  Returns the application-wide color map used in all drawing operations. If you do not call IApplication::current().setColorMap to establish your own color map, this function returns IColorMap::webSafeColorMap().

  All IFrameWindow constructors call this function to determine the color map to use for drawing in the frame window and the child windows of the frame window.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Process Information

Use these members to access process information.

pib

      protected:
      struct pib_s& pib()

  Returns a pointer to the process information block for the current process.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | No

### Resource Libraries

Use these members to access the default resource libraries that Open Class Library uses to load resources that it provides, as well as those provided by your application. These resources include strings, menus, accelerator tables, and bitmaps.

resourceLibrary

      public:
      virtual IResourceLibrary& resourceLibrary() const

  Obtains a reference to the Open Class Library's resource library. Open Class Library loads the resources that it requires from this resource library. To change the name of the resouce library, call ICurrentApplication::setResourceLibrary or set the environment variable ICLUI_RESLIB with the name of the dynamic link library or shared library.

  If you do not call ICurrentApplication::setResourceLibrary to identify Open Class Library's resource library, ICurrentApplication::resourceLibrary first searches the NLSPATH and then it searches the LIBPATH to locate the library.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  A dynamic-link library is equivalent to a shared library.

  If you do not change the name of the resource library, this function returns a handle to libvacocres.o.

  If this function cannot find the resource library using NLSPATH and LIBPATH, it searches for the resource library in /usr/vacpp/loc/C.

  You can set the environment variable, ICLUI_RESLIB, using the statement export ICLUI_RESLIB=newname from an operating system command line.

OS/2 Considerations

  If you do not change the name of the resource library, this function returns a handle to cpporr40.dll.

  You can set the environment variable, ICLUI_RESLIB, using the statement set ICLUI_RESLIB=newname from an operating system command line.

Windows Considerations

  If you do not change the name of the resource library, this function returns a handle to cpporr40.dll.

  You can set the environment variable, ICLUI_RESLIB, using the statement set ICLUI_RESLIB=newname from an operating system command line.

setResourceLibrary

      public:
      virtual ICurrentApplication&
        setResourceLibrary( const char* resLibName,
                            IDynamicLinkLibrary::ESearchLocation searchLocation = IDynamicLinkLibrary::kOSDefaultSearch )

  Sets the default resource library for Open Class Library resources, returned by resourceLibrary. Open Class Library uses this resouce library to load the resources it provides, such as bitmaps and text for standard toolbar buttons.

  You specify a resource library using the name of a dynamic link library or a value of 0. If you specifiy 0, Open Class Library attempts to load its resources from the application's executable file.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  A dynamic-link library is equivalent to a shared library. You can optionally specify the .o extension when naming a shared library.

  If you do not call this function, Open Class Library loads its resources from libvacocres.o.

OS/2 Considerations

  To specify a dynamic link library (DLL) as the resource library, do not include its file extension when passing its name to this function. If you do not call this function, Open Class Library loads its resources from cpporr40.dll.
  Note: Per the licensing agreement, before you ship an application developed with Open Class Library, you must rename the Open Class Library resource library that you ship with your application. Call this function at the beginning of your application to specify the new name of the resource library.

Windows Considerations

  To specify a dynamic link library (DLL) as the resource library, do not include its file extension when passing its name to this function. If you do not call this function, Open Class Library loads its resources from cpporr40.dll.
  Note: Per the licensing agreement, before you ship an application developed with Open Class Library, you must rename the Open Class Library resource library that you ship with your application. Call this function at the beginning of your application to specify the new name of the resource library.

setUserResourceLibrary

      public:
      virtual ICurrentApplication&
        setUserResourceLibrary( const char* resLibName,
                                IDynamicLinkLibrary::ESearchLocation searchLocation = IDynamicLinkLibrary::kOSDefaultSearch )

  Sets the default resource library for application-defined resources, returned by userResourceLibrary. Open Class Library uses this resource library to load an application-defined resource when you do not otherwise identify a resource library. You can specify a resource library when constructing an IResourceId object to identify a resource. If you do not call setUserResourceLibrary, the default application-defined resource library is the executable file.
  Note: You can use an argument of 0 for the resLibName parameter to reset the resource library for application-defined resouces to the executable file.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  A dynamic-link library is equivalent to a shared library. You can optionally specify the .o extension when naming a shared library.

OS/2 Considerations

  To specify a dynamic link library (DLL) as the resource library, do not include its file extension when passing its name to this function.

Windows Considerations

  To specify a dynamic link library (DLL) as the resource library, do not include its file extension when passing its name to this function.

userResourceLibrary

      public:
      virtual IResourceLibrary& userResourceLibrary() const

  Obtains a reference to the default resource library that Open Class Library uses to load application-defined resources for this application. If you do not explicitly specify an application-defined resource library via setUserResourceLibrary, IResourceId uses the executable file.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Starting and Stopping

Use these members to start or stop the current process.

exit

      public:
      virtual ICurrentApplication& exit()

  Ends the current thread of execution by calling ICurrentThread::exit. If the current thread is thread 1, the process ends.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

run

      public:
      virtual ICurrentApplication& run()

  Starts the processing of events in the current process by calling ICurrentThread::processMsgs.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### ICurrentApplication - Inherited Member Functions and Data

#### Inherited Public Functions

  INonGUIApplication

  -     virtual INonGUIApplication&
          adjustPriority( long adjustment,
                          bool setDescendents = false )

  -     virtual IString asDebugInfo() const

  -     virtual IString asString() const

  -     static ICurrentNonGUIApplication& current()

  -     static IProcessId currentPID()

  -     virtual IProcessId id() const

  -     virtual INonGUIApplication&
          setPriority( PriorityClass priorityClass,
                       long priorityLevel = 0,
                       bool setDescendents = false )

  -     virtual INonGUIApplication&
          setProcessPriority( const EProcessPriority newPrio )

  IApplication

  -     static ICurrentApplication& current()

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  IApplication

  -     virtual ~IApplication()

  -     IApplication(const IProcessId& id)

  INonGUIApplication

  -     virtual ~INonGUIApplication()

  -     INonGUIApplication(const IProcessId& id)

  -     virtual INonGUIApplication& setId(const IProcessId& id)

#### Inherited Protected Data

  - None