A simple example here I want to load some embedded text file to my application but when I use FindResourceW
I get compile-time error:
HGLOBAL res_handle = NULL;
HRSRC res;
wchar_t* res_data;
DWORD res_size;
// NOTE: providing g_hInstance is important, NULL might not work
res = FindResourceW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(MY_RESOURCE), RT_RCDATA);
if (!res)
return 1;
In my .rc
file I defined the resource like this:
MY_RESOURCE RCDATA L"Help topics.txt"
The error:
Severity Code Description Project File Line Error C2664 'HRSRC FindResourceW(HMODULE,LPCWSTR,LPCWSTR)': cannot convert argument 3 from 'LPSTR' to 'LPCWSTR' FindFilesProj C:\Users\WongFei\Desktop\FindFilesProj UNICODE\WinMain.cpp 674