Click here to Skip to main content
Click here to Skip to main content
Go to top

IconsST v1.2

, 26 Nov 2001
Rate this:
Please Sign up or sign in to vote.
A collection of usefull icons contained into a DLL
<!-- Download Links -->

Sample Image

SoftechSoftware homepage
SoftechSoftware Email

Abstract

IconsST is a resource-only DLL containing a number of usefull, ready-to-use icons of various sizes and colors.
This DLL can be loaded and accessed using the commong Win32 API functions or via the CResourceServerST class.

CResourceServerST lets to load a generic resource-only DLL and to access nearly all the resource types that can be contained.
Current version of CResourceServerST is 1.1

The demo application shows only a little number of the icons contained into the DLL. For the complete list of the icons
please refer to this image.

How to integrate CResourceServerST in your application

In your project include the following files:

  • ResourceServerST.h
  • ResourceServerST.cpp
Where needed, create an instance of CResourceServerST:
CResourceServerST m_Icons;
Now lets the instance to load a DLL. This can be done in the application init-section or, for dialog-based applications, in your OnInitDialog:
// Load IconsST.dll
DWORD dwRetValue;
dwRetValue = m_Icons.Load(_T("c:\\IconsST.dll"));
ASSERT(dwRetValue == RESSRVST_OK);
The DLL will be automatically unloaded when the instance goes out of scope.
To manually unload the DLL (for example to load another one) the UnLoad() method can be used:
// Unload IconsST.dll
DWORD dwRetValue;
dwRetValue = m_Icons.UnLoad();
ASSERT(dwRetValue == RESSRVST_OK);

Class methods

CResourceServerST
Constructs a CResourceServerST object. Optionally a DLL can be loaded.

// Parameters:
//     [IN]   lpszDllName
//            Points to a zero-terminated string containing the complete
//            path and name of the DLL to load.
//     [IN]   dwFlags
//            Specifies the action to take when loading the DLL. For a complete
//            list of the available flags please refer to the online help
//            for the Win32 API function LoadLibraryEx.
//
// Return value:
//
// No value can be returned by a constructor. Call the CResourceServerST::GetLastError()
// function to get the return value. Possible values are:
//
//      RESSRVST_OK
//          Class initialized and DLL loaded successfully.
//      RESSRVST_NOINIT
//          Load failed.
//          Class not initialized.
//      RESSRVST_ALREADYINIT
//          Class is already handling a DLL.
//      RESSRVST_DLLNOTFOUND
//          The specified DLL cannot be found.
//
CResourceServerST(LPCTSTR lpszDllName = NULL, DWORD dwFlags = 0)
Load
Initializes the CResourceServerST class loading the specified DLL.
// Parameters:
//     [IN]   lpszDllName
//            Points to a zero-terminated string containing the complete
//            path and name of the DLL to load.
//     [IN]   dwFlags
//            Specifies the action to take when loading the DLL. For a complete
//            list of the available flags please refer to the online help
//            for the Win32 API function LoadLibraryEx.
//
// Return value:
//      RESSRVST_OK
//          Class initialized and DLL loaded successfully.
//      RESSRVST_NOINIT
//          Load failed.
//          Class not initialized.
//      RESSRVST_ALREADYINIT
//          Class is already handling a DLL.
//      RESSRVST_DLLNOTFOUND
//          The specified DLL cannot be found.
//
DWORD Load(LPCTSTR lpszDllName, DWORD dwFlags = 0)
UnLoad
Unloads the previously loaded DLL.
// Return value:
//      RESSRVST_OK
//          DLL unloaded or no DLL previously loaded.
//      RESSRVST_FREELIBRARYKO
//          ::FreeLibrary has failed (The class remains initialized).
//
DWORD UnLoad()
LoadImage
Loads an icon, cursor or bitmap.
// Parameters:
//     [IN]   lpszName
//            Name or identifier of the image to load.
//     [IN]   uType
//            Type of the image. Can be one of the following types:
//            IMAGE_BITMAP
//            IMAGE_CURSOR
//            IMAGE_ICON
//     [IN]   cxDesired
//            Desired width.
//     [IN]   cyDesired
//            Desired height.
//     [IN]   fuLoad
//            Load flags. For a complete list of the available flags please
//            refer to the online help for the Win32 API function LoadImage.
//
// Return value:
//      If the function succeeds, the return value is the handle of the 
//      newly loaded image. 
//      If the function fails, the return value is NULL. 
//
HANDLE LoadImage(LPCTSTR lpszName, UINT uType, int cxDesired, int cyDesired, UINT fuLoad)
LoadImage
Loads an icon, cursor or bitmap.
// Parameters:
//     [IN]   uID
//            Specifies the integer identifier of the image to load
//     [IN]   uType
//            Type of the image. Can be one of the following types:
//            IMAGE_BITMAP
//            IMAGE_CURSOR
//            IMAGE_ICON
//     [IN]   cxDesired
//            Desired width.
//     [IN]   cyDesired
//            Desired height.
//     [IN]   fuLoad
//            Load flags. For a complete list of the available flags please
//            refer to the online help for the Win32 API function LoadImage.
//
// Return value:
//      If the function succeeds, the return value is the handle of the 
//      newly loaded image. 
//      If the function fails, the return value is NULL. 
//
HANDLE LoadImage(UINT uID, UINT uType, int cxDesired, int cyDesired, UINT fuLoad)
LoadIcon
Loads an icon.
// Parameters:
//     [IN]   lpszName
//            Name or identifier of the icon to load.
//
// Return value:
//      If the function succeeds, the return value is the HICON handle of the
//      newly loaded icon. 
//      If the function fails, the return value is NULL. 
//
HICON LoadIcon(LPCTSTR lpszName)
LoadIcon
Loads an icon.
// Parameters:
//     [IN]   uID 
//            Specifies the integer identifier of the icon to load.
//
// Return value:
//      If the function succeeds, the return value is the HICON handle of the
//      newly loaded icon. 
//      If the function fails, the return value is NULL. 
//
HICON LoadIcon(UINT uID)
LoadString
Loads a string from a stringtable in the DLL.
// Parameters:
//     [IN]   uID 
//            Specifies the integer identifier of the string to be loaded.
//     [OUT]  lpBuffer 
//            Points to the buffer to receive the string.
//     [IN]   nBufferMax 
//            Specifies the size of the buffer in bytes (ANSI version) 
//            or characters (Unicode version). The string is truncated
//            and null terminated if it is longer than the number of 
//            characters specified.
//
// Return value:
//      If the function succeeds, the return value is the number of 
//      bytes (ANSI version) or characters (Unicode version) copied into
//      the buffer, not including the null-terminating character, or zero
//      if the string resource does not exist
//
DWORD LoadString(UINT nID, LPTSTR lpBuffer, int nBufferMax)
LoadString
Loads a string from a stringtable in the DLL.
// Parameters:
//     [IN]   uID 
//            Specifies the integer identifier of the string to load.
//     [OUT]  spBuffer
//            Points to a CString object to receive the string.
//
// Return value:
//      RESSRVST_OK
//          Function executed successfully.
//      RESSRVST_NOINIT
//          No DLL was previously loaded.
//      RESSRVST_INVALIDPTR
//          Invalid pointer to CString passed.
//      RESSRVST_RESNOTFOUND
//          The specified resource identifier was not found.
//
DWORD LoadString(UINT nID, CString* spBuffer)
FindResource
Determines the location of a resource with the specified type and name.
// Parameters:
//     [IN]   lpName
//            Pointer to resource name.
//     [IN]   lpType
//            Pointer to resource type.
//
// Return value:
//      If the function succeeds, the return value is a handle to the 
//      specified resource’s info block. To obtain a handle to the resource,
//      pass this handle to the LoadResource function. 
//      If the function fails, the return value is NULL.
//
HRSRC FindResource(LPCTSTR lpName, LPCTSTR lpType)
LoadResource
Loads into global memory the resource with the specified type and name.
// Parameters:
//     [IN]   lpszName
//            Pointer to resource name.
//     [IN]   lpszType
//            Pointer to resource type.
//
// Return value:
//      If the function succeeds, the return value is a handle to the 
//      global memory block containing the data associated with the resource. 
//      If the function fails, the return value is NULL.
//
//      The return type of LoadResource is HGLOBAL for backward compatibility,
//      not because the function returns a handle to a global memory block. 
//      Do not pass this handle to the GlobalLock or GlobalFree function. 
//      To obtain a pointer to the resource data, call the LockResource function. 
//      For a more informations please refer to the online help for the 
//      Win32 API function LoadResource.
//
HGLOBAL LoadResource(LPCTSTR lpszName, LPCTSTR lpszType)
LoadResource
Loads into global memory the resource with the specified type and name.
// Parameters:
//     [IN]   hResInfo
//            Handle to resource's info block
//
// Return value:
//      If the function succeeds, the return value is a handle to the 
//      global memory block containing the data associated with the resource. 
//      If the function fails, the return value is NULL.
//
//      The return type of LoadResource is HGLOBAL for backward compatibility,
//      not because the function returns a handle to a global memory block. 
//      Do not pass this handle to the GlobalLock or GlobalFree function. 
//      To obtain a pointer to the resource data, call the LockResource function. 
//      For a more informations please refer to the online help for the 
//      Win32 API function LoadResource.
//
HGLOBAL LoadResource(HRSRC hResInfo)
LoadDialog
Loads into global memory the specified dialog template.
// Parameters:
//     [IN]   nID
//            Contains the ID number of a dialog-box template resource.
//
// Return value:
//      If the function succeeds, the return value is a handle to the 
//      global memory block containing the dialog-box template specified. 
//      If the function fails, the return value is NULL.
//
//      The return type of LoadResource is HGLOBAL for backward compatibility,
//      not because the function returns a handle to a global memory block. 
//      Do not pass this handle to the GlobalLock or GlobalFree function. 
//      To obtain a pointer to the resource data, call the LockResource function. 
//      For a more informations please refer to the online help for the 
//      Win32 API function LoadResource.
//
HGLOBAL LoadDialog(UINT nID)
GetLastError
Returns the last error generated by the class.
// Return value:
//      The last error generated by the class. RESSRVST_OK if no error.
//
DWORD GetLastError()

History (CResourceServerST)

  • v1.1 (26/November/2001)
    First public release
  • v1.0 (26/August/1999)
    Private release

Want to include CResourceServerST in a DLL ?

CResourceServerST is ready to be used from inside a DLL. You need to export from your DLL CResourceServerST. Include in your DLL's project the following files:

  • ResourceServerST.h
  • ResourceServerST.cpp
Add to your DLL's project settings the following defines:
  • _CMLHTDLL_NOLIB_
  • _CMLHTDLL_BUILDDLL_
From ResourceServerST.h comment the following line:
#define _RESOURCESERVERST_NODLL_
then update the various #pragma comment(lib, "???") according to your DLL produced .lib files.

Disclaimer

THE SOFTWARE AND THE ACCOMPANYING FILES ARE DISTRIBUTED "AS IS" AND WITHOUT ANY WARRANTIES WHETHER EXPRESSED OR IMPLIED. NO REPONSIBILITIES FOR POSSIBLE DAMAGES OR EVEN FUNCTIONALITY CAN BE TAKEN. THE USER MUST ASSUME THE ENTIRE RISK OF USING THIS SOFTWARE.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Davide Calabro
Web Developer
Italy Italy
No Biography provided

Comments and Discussions

 
GeneralMy vote of 5 Pinmembergndnet23-Sep-12 3:26 
GeneralDon't we need seprate dll for debug and release version of application. Pinmembertemp555628-May-03 4:22 
GeneralRe: Don't we need seprate dll for debug and release version of application. PinmemberDavide Calabro28-May-03 5:43 
Questionhow many icons can win98 handle? PinmembereXplodus17-Apr-03 2:03 
GeneralIcon-access by position PinmemberAnonymous27-Jun-02 0:19 
GeneralRe: Icon-access by position PinmemberArmen Hakobyan11-Aug-02 11:39 
QuestionHow to Create CustomST.dll? PinmemberManikandan7-Mar-02 16:26 
AnswerRe: How to Create CustomST.dll? PinmemberDavide Calabro7-Mar-02 20:29 
GeneralJust a question PinmemberRmamon Casellas27-Nov-01 7:40 
GeneralRe: Just a question PinmemberDavide Calabro27-Nov-01 7:44 
GeneralCopyright PinmemberOz Solomonovich27-Nov-01 14:25 
GeneralRe: Copyright PinmemberDavide Calabro27-Nov-01 21:10 
GeneralRe: Copyright PinmemberMal Ross27-Nov-01 21:50 
GeneralRe: Copyright PinmemberDragonSphere26-Jan-06 14:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 27 Nov 2001
Article Copyright 2001 by Davide Calabro
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid