OILTool Class Reference

#include <oiltool.h>

List of all members.

Public Member Functions

 OILTool (UINT32 ModuleID)
 Create an OILTool object that can be linked to a Tool object (via a ToolListItem object). This object (the OILTool) knows the instance handle of the DLL that contains the tool.
HCURSOR LoadCursor (UINT32 ID)
 Find a cursor resource, which may be in the kernel's resources, or it may be from the tool's own resources.
HBITMAP LoadBitmap (UINT32 ID)
 Find a bitmap resource, which may be in the kernel's resources, or it may be from the tool's own resources.
HICON LoadIcon (UINT32 ID)
 Find an icon resource, which may be in the kernel's resources, or it may be from the tool's own resources.
BOOL LoadString (UINT32 ID, char *)
 Find a string resource, which may be in the kernel's resources, or it may be from the tool's own resources.

Public Attributes

HINSTANCE hInstance


Detailed Description

Definition at line 108 of file oiltool.h.


Constructor & Destructor Documentation

OILTool::OILTool UINT32  ModuleID  ) 
 

Create an OILTool object that can be linked to a Tool object (via a ToolListItem object). This object (the OILTool) knows the instance handle of the DLL that contains the tool.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/93
Parameters:
ModuleID - the ID of the module that owns this Tool. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Tool; ToolListItem; Module; ModuleListItem

Definition at line 126 of file oiltool.cpp.

00127 {
00128     // Obtain and remember the Instance handle of the DLL that holds the resources
00129     // of the parent module of this tool (and hence holds the resources of the tool).
00130     hInstance = OILModule::GetInstance(ModuleID);
00131 }


Member Function Documentation

HBITMAP OILTool::LoadBitmap UINT32  ID  ) 
 

Find a bitmap resource, which may be in the kernel's resources, or it may be from the tool's own resources.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/93
Parameters:
ID - The resource ID of the bitmap to load. [INPUTS]
- [OUTPUTS]
Returns:
The handle to the loaded bitmap, or NULL if unsuccessful

Errors: -

See also:
-

Definition at line 183 of file oiltool.cpp.

00184 {
00185     HINSTANCE Inst;
00186     
00187     if ((DLLs[0] == (HINSTANCE)HINSTANCE_ERROR || DLLs[0] == 0) || ((ID >= KID_FIRST) && (ID <= KID_LAST)))
00188         Inst = AfxGetResourceHandle();  // Kernel resource - get the HINSTANCE of our .EXE
00189     else
00190         Inst = hInstance;               // otherwise use the HINSTANCE of the Tool's DLL
00191         
00192     // If the HINSTANCE we have is valid, attempt to load the resource, otherwise
00193     // return a NULL value.
00194         
00195     if (Inst > (HINSTANCE)HINSTANCE_ERROR)
00196         return ::LoadBitmap(Inst, MAKEINTRESOURCE(ID));
00197     else
00198         return NULL;
00199 }

HCURSOR OILTool::LoadCursor UINT32  ID  ) 
 

Find a cursor resource, which may be in the kernel's resources, or it may be from the tool's own resources.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/93
Parameters:
ID - The resource ID of the cursor to load. [INPUTS]
- [OUTPUTS]
Returns:
The handle to the loaded cursor, or NULL if unsuccessful

Errors: -

See also:
-

Definition at line 149 of file oiltool.cpp.

00150 {
00151     HINSTANCE Inst;
00152     
00153     if ((DLLs[0] == (HINSTANCE)HINSTANCE_ERROR || DLLs[0] == 0) || ((ID >= KID_FIRST) && (ID <= KID_LAST)))
00154         Inst = AfxGetResourceHandle();  // Kernel resource - get the HINSTANCE of our dll, or .EXE
00155     else
00156         Inst = hInstance;               // otherwise use the HINSTANCE of the Tool's DLL
00157 
00158     // If the HINSTANCE we have is valid, attempt to load the resource, otherwise
00159     // return a NULL value.
00160         
00161     if (Inst > (HINSTANCE)HINSTANCE_ERROR)
00162         return ::LoadCursor(Inst, MAKEINTRESOURCE(ID));
00163     else
00164         return NULL;
00165 }

HICON OILTool::LoadIcon UINT32  ID  ) 
 

Find an icon resource, which may be in the kernel's resources, or it may be from the tool's own resources.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/93
Parameters:
ID - The resource ID of the icon to load. [INPUTS]
- [OUTPUTS]
Returns:
The handle to the loaded icon, or NULL if unsuccessful

Errors: -

See also:
-

Definition at line 217 of file oiltool.cpp.

00218 {
00219     HINSTANCE Inst;
00220     
00221     if ((DLLs[0] == (HINSTANCE)HINSTANCE_ERROR || DLLs[0] == 0) || ((ID >= KID_FIRST) && (ID <= KID_LAST)))
00222         Inst = AfxGetResourceHandle();  // Kernel resource - get the HINSTANCE of our .EXE
00223     else
00224         Inst = hInstance;               // otherwise use the HINSTANCE of the Tool's DLL
00225         
00226     // If the HINSTANCE we have is valid, attempt to load the resource, otherwise
00227     // return a NULL value.
00228         
00229     if (Inst > (HINSTANCE)HINSTANCE_ERROR)
00230         return ::LoadIcon(Inst, MAKEINTRESOURCE(ID));
00231     else
00232         return NULL;
00233 }

BOOL OILTool::LoadString UINT32  ID,
char *  Description
 

Find a string resource, which may be in the kernel's resources, or it may be from the tool's own resources.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/93
Parameters:
ID - The resource ID of the string to load. [INPUTS]
The String that was loaded [OUTPUTS]
Returns:
TRUE if String is loaded successfully, or FALSE Otherwise

Errors: -

See also:
-

Definition at line 251 of file oiltool.cpp.

00252 {
00253     // Maximum allowable size of a windows string resource
00254     const INT32 MaxStringSize = 256;
00255 
00256     HINSTANCE Inst;
00257     
00258     if ((DLLs[0] == (HINSTANCE)HINSTANCE_ERROR || DLLs[0] == 0) || ((ID >= KID_FIRST) && (ID <= KID_LAST)))
00259         Inst = AfxGetResourceHandle();  // Kernel resource - get the HINSTANCE of our .EXE
00260     else
00261         Inst = hInstance;               // otherwise use the HINSTANCE of the Tool's DLL
00262         
00263     // If the HINSTANCE we have is valid, attempt to load the resource, otherwise
00264     // return FALSE.
00265         
00266     if (Inst > (HINSTANCE)HINSTANCE_ERROR)
00267         return ::LoadString(Inst, ID, Description, MaxStringSize);
00268     else
00269         return FALSE;
00270 }


Member Data Documentation

HINSTANCE OILTool::hInstance
 

Definition at line 121 of file oiltool.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:22 2007 for Camelot by  doxygen 1.4.4