Re: LoadResource function
Hey,
I have this so far.
Code:
#include <windows.h>
#include <stdio.h>
#include "resource.h"
int Metas[3] = {Graphic1, JVEST01C, JVEST01F};
HRSRC reshandle;
HMODULE hexe;
HGLOBAL hglobal;
char *lock;
void main()
{
printf("1st element: %d\n", Metas[0]);
printf("2nd element: %d\n", Metas[1]);
printf("3rd element: %d\n", Metas[2]);
hexe = GetModuleHandle(NULL);
reshandle = FindResource(hexe, MAKEINTRESOURCE(Metas[0]), "Metafile");
if (reshandle == NULL)
printf("Did not find resource.\n");
else
printf("reshandle: %d\n", reshandle);
hglobal = LoadResource(hexe, reshandle);
if (hglobal == NULL)
printf("Did not load resource\n");
else
printf("hglobal: %d\n", hglobal);
lock = (char*) LockResource(hglobal);
if (lock == NULL)
printf("could not lock resource\n");
else
printf("lock: %d\n", lock);
printf("Press any key to exit...\n");
getchar();
UnlockResource(hglobal);
}
I need to be able to convert the resource into an istream type. How would I go about doing that? I realize that right now, it is being read into a char data type but it is just for testing. I am fairly new to C++ so any help would be greatly appreciated.
Thanks in advance,