Loads an image from the resources embedded in a .dll or .exe file and assigns it to the table Picture.
VB6 Copy Code |
---|
Public Sub LoadPicFromRes( _ |
C++ Copy Code |
---|
public: |
A HINSTANCE. This is the handle of the module from which the resource is to be loaded.
The name of the resource. Use MAKEINTRESOURCE macro if you use integer identifiers for your resources (in Visual C++).
The name of the resource type.
Loads an image from a resource in the table. Note that standard icon and bitmap resources are not supported. You should insert your pictures as custom resources, either by pasting the binary contents of the image file into the resource binary code or by addressing it through the resource script.
Following syntax in the .RC file makes the latter:
Copy Code |
---|
RESNAME TYPENAME "path to file" |
The image can be loaded in the table that way:
Copy Code |
---|
fc.LoadPicFromRsc((ULONG)AfxGetResourceHandle(), RESNAME, TYPENAME) |
Check the PicFromRes sample to see how Windows resources can be accessed from VB.