Extract information from RCDATA resource

Viewed 135

I have following code

HINSTANCE hinst = GetModuleHandleW(NULL);
HRSRC hrsrc = FindResourceW(hinst, MAKEINTRESOURCE(IDR_RCDATA), RT_RCDATA);
HGLOBAL hglob = LoadResource(hinst, hrsrc);
void* pMem = LockResource(hglob);
DWORD size = SizeofResource(0, hrsrc);

Rc file contains

IDR_RCDATA RCDATA { "RCDATA content\0" }

Qeustion: How I can get this IDR_RCDATA and put into char array?

1 Answers

You can just cast the result from LockResource to whatever you think it contains, something like this:

char* pMem = (char*)LockResource(hglob);

if it's an ANSI string.

Related