all
I have source below:

in my .rc file
IDR_XML1 XML "LoginQuery.xml"
in my resource.h file
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
//
#define IDR_XML1 106
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
and in my .cpp file.
HMODULE handle = ::GetModuleHandle(NULL);
HRSRC rc = ::FindResource(handle, MAKEINTRESOURCE(IDR_XML1), MAKEINTRESOURCE("XML"));
HGLOBAL rcData = ::LoadResource(handle, rc);
DWORD size = ::SizeofResource(handle, rc);
const char* data = static_cast<const char*>(::LockResource(rcData));
But data returns null.
What am I doing wrong?
EDIT
My C++ project is dll project, and I am reading the file inside of that project.
MAKEINTRESOURCE("XML")with just plain"XML".MAKEINTRESOURCEexpects anintas its parameter, hence the name. - Igor TandetnikHINSTANCEhandle passed toDllMain.GetModuleHandle(NULL)gives you the handle to the hosting EXE (which, naturally, doesn't have that resource). - Igor Tandetnik