
Help - custom resources loading question.
I am writing a computer game and wish to switch to "custom resources" from using external files. I got the following code to load a custom resource:
char* LoadCustomResource(int resID, HINSTANCE hinstance)
{
HRSRC hResInfo;
HGLOBAL hResource;
// first find the resource info block
if ((hResInfo = FindResource(hinstance,
MAKEINTRESOURCE(resID),
"TEXTFILE")) == NULL)
return(NULL);
// now get a handle to the resource
if ((hResource = LoadResource(hinstance, hResInfo)) == NULL)
return(NULL);
// finally get and return a pointer to the resource
return ((char*)LockResource(hResource));
}
The problem is some of my files - especially my "level" file types are quite complex. I already have a loader for it using a file pointer (FILE *fp). My understanding of external resources is that you have a big array of data and u know the size of the array from SizeofResource(hResource). This is quite different from my file pointer from which I can call fread and frwite and such...
Is there some way I can get a "filename" of my custom resource and handle it exactly as a file so I dont have to rewrite my complex loaders? Any help or thoughts would be appreciated.
Check out my project:
web page