Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using win32 console application which has custom resources under "BINARIES" type,having ID - IDR_BINARIES1 which refers to an external binary file(res\example.bin).

I need to load the data in file into an array,but when i find the resource i could not get handle.

This is the code snippet -
TCHAR sRestype[] = _T("BINARIES");
BOOL retVal = false;
szResName =(LPCTSTR) MAKEINTRESOURCE(IDR_BINARIES1);
hres = FindResource(NULL, sResName, sRestype);
if (hres == 0)
return FAIL;
nlen = SizeofResource(NULL, hres);
pArray = (BYTE*)LoadResource(0, hres);

Please help.thanks in advance
Posted
Comments
Sergey Podobry 13-May-10 2:43am    
Are you sure that IDR_BINARIES1 is correct and the specified resource exists in your app?
hakz.code 13-May-10 2:58am    
yes

Maybe the issue is in resource type. Because it's not the standard resource type, Specify the resource type argument with RT_RCDATA(Application-defined resource).
 
Share this answer
 
Thanks for the help guys,

I got it resolved by mentioning type and name of resource in Findresource function.
I was creating a custom type of resource by clicking on Custom button in Add Resource dialog,rather now I imported the resource.
hres = FindResource(NULL,"#129", "Binaryfiles");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900