OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TResource< T, resType > Class Template Reference

TResource simplifies access to a resource by encapsulating the find, load, lock and free steps for accessing a resource. More...

#include <owl/wsyscls.h>

Public Member Functions

 TResource (HINSTANCE hModule, TResId resId)
 Loads & locks the specified resource..
 
 TResource (HINSTANCE hModule, TResId resid, LANGID langid)
 Loads & locks a resource of the type 'resType' from the module (hModule).
 
 ~TResource ()
 Unlocks and frees the resource loaded earlier.
 
bool IsOK () const
 Confirms whether resource was found.
 
 operator T* ()
 Conversion operator to point to structure representing binary layout of the resource...
 
DWORD GetSize () const
 Returns the size in bytes of the loaded resource.
 

Protected Attributes

HGLOBAL MemHandle
 Handle of resource.
 
T * MemPtr
 Pointer to locked resource.
 

Detailed Description

template<class T, int resType>
class owl::TResource< T, resType >

TResource simplifies access to a resource by encapsulating the find, load, lock and free steps for accessing a resource.

Definition at line 498 of file wsyscls.h.

Constructor & Destructor Documentation

◆ TResource() [1/2]

template<class T , int resType>
owl::TResource< T, resType >::TResource ( HINSTANCE hModule,
TResId resId )

Loads & locks the specified resource..

Definition at line 619 of file wsyscls.h.

References owl::TResource< T, resType >::MemHandle, and owl::TResource< T, resType >::MemPtr.

◆ TResource() [2/2]

template<class T , int resType>
owl::TResource< T, resType >::TResource ( HINSTANCE hModule,
TResId resId,
LANGID lcid )

Loads & locks a resource of the type 'resType' from the module (hModule).

Accepts a LanguageID for localized resources.

Definition at line 640 of file wsyscls.h.

References owl::TResource< T, resType >::MemHandle, and owl::TResource< T, resType >::MemPtr.

◆ ~TResource()

template<class T , int resType>
owl::TResource< T, resType >::~TResource ( )

Unlocks and frees the resource loaded earlier.

Note
Unlocking and freeing of resources is not necessary in WIN32.

Definition at line 661 of file wsyscls.h.

Member Function Documentation

◆ GetSize()

template<class T , int resType>
DWORD owl::TResource< T, resType >::GetSize ( ) const

Returns the size in bytes of the loaded resource.

Returns the size, in bytes, of the loaded resource.

Definition at line 700 of file wsyscls.h.

References PRECONDITION.

◆ IsOK()

template<class T , int resType>
bool owl::TResource< T, resType >::IsOK ( ) const

Confirms whether resource was found.

Returns true if resource was successfully loaded or false otherwise.

Definition at line 676 of file wsyscls.h.

◆ operator T*()

template<class T , int resType>
owl::TResource< T, resType >::operator T* ( )

Conversion operator to point to structure representing binary layout of the resource...

Returns a pointer to the locked resource.

Note
This operator eliminates the need to explicitly cast LPVOID to a structure representing the actual layout of individual resource types.

Definition at line 689 of file wsyscls.h.

References PRECONDITION.

Member Data Documentation

◆ MemHandle

template<class T , int resType>
HGLOBAL owl::TResource< T, resType >::MemHandle
protected

Handle of resource.

Definition at line 508 of file wsyscls.h.

◆ MemPtr

template<class T , int resType>
T* owl::TResource< T, resType >::MemPtr
protected

Pointer to locked resource.

Definition at line 509 of file wsyscls.h.


The documentation for this class was generated from the following file: