The fICON class is simply a class to hold a handle to an icon. You can then return the handle to this icon and do things with it. Nice, simple, easy. About the only advantage over manually loading an icon that this class offers would be that the functions provided by this class make this task slighlty easier.
|
| Prototype |
Description |
|
|
HICON GetIcon(void);
|
This function returns the handle to the icon, which you can then use to pass along to other functions. Please note that it is preferred that you use this function to return the handle rather than referring to the Icon member of this class.
|
|
void LoadIconResource(char* Name, int ID);
|
This function loads an icon from the current programs resources. You can specify either the name of the resource or it's ID number. If you use the ID, then you must pass NULL for Name, and if you use the Name, then you must pass 0 for ID.
|
|
void LoadIconResource(HINSTANCE Instance, char* Name, int ID);
|
This function works like the above function except for the fact that it loads the icon from the resources found in the module specifed by Instance. In this way you can load a DLL and then extract an icon from that, by passing along the DLL's HINSTANCE.
|
|
void LoadIconFromFile(char* Filename);
|
This function loads an icon from file, from the file specified by Filename. I shouldn't think that this function requires anymore explanation...
|
|
void SetIcon(HICON IconToSet);
|
This function sets the icon from a HICON that you may have just had hanging around. Please note that this function will only copy the handle, so if you go and DeleteObject() the original handle, you will lose the Icon. However, once you have passed the handle to this class, you can use that handle again without needing to worry about deleting that icon, as this class will do that for you when it is destroyed.
|
The following snippet gives a basic idea of how to use this component.