Ivan  Petrov
Ivan Petrov

Reputation: 155

FindResource() doesn't work

I've got and exe file as resource in my programm. In some occasions I need to extract that programm from resources and put it on harddrive. So I've added a resource to my project:

IDR_EXE1                EXE                     "res\\output.exe"

And then i want to extract it, but it fails on the very first step on this function:

HRSRC hRes = FindResource(NULL, MAKEINTRESOURCE(IDR_EXE1), MAKEINTRESOURCE(IDR_EXE1));

It returns error 1813 - resource can't be found. I'ts strange, because accordingly to MSDN all parametrs are right. Can someone explaing what is wrong here, cause it's a simple task but i can't complete it for a while. Thank you!

Upvotes: 0

Views: 713

Answers (1)

Ivan  Petrov
Ivan Petrov

Reputation: 155

In order to work i specified resource type manually:

HRSRC hRes = FindResource(NULL, MAKEINTRESOURCE(IDR_EXE1), L"EXE");

Upvotes: 3

Related Questions