IconsST v1.2 - A collection of useful icons contained into a DLL

Abstract

IconsST is a resource-only DLL containing a number of useful, 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 used 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 small number of the icons contained in 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 create the instance to load a DLL. This can be done in the application init-section or, for dialog-based applications, in your OnInitDialog:

// 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)

// 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)

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()

CResourceServerST History

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.

Nice work.

Perfect work

It's very nice example of dynamical loading of resources Dave, so don't fell disturbed by some s****d people, who want to just make noise. Is anybody of them made some 'public' code before and distributed it? I think that you made very good work and using of M$ icons - it's about example for developers, not about commercial application.. The guys from M$ will shake hands with you for this example:))

Ignore People Who Think They are God!

You have the right to re-distribute the icons--read Microsoft's license agreement.

What is amusing is the SELF-righteous people who THINK they know something and are all too quick to act like the "Thought Police" who are going to protect us from ourselves. The mentality of these people, i.e., the "thought Police," make me sick and we all need to put them in their place FAST!

Uh, yeah, it's against the law. Why did CodeGuru even accept this link? It's *ok* to accept the code; that's not the issue.. It's the DLL that this [expletive deleted] is trying to pass off as his own.