resource files in ddk

Hello,

I’ve got a problem with adding resources to my application compiled with ddk.
In vs I’ve added new exe file by clicking right on project -> add resource then import and I added my exe file.

Now in my source file I’ve added

SOURCES=source.c \
RESOURCE.rc

COPYRES=1
RESFILE=$(TARGETNAME).res

and it seems that generated executable has this resource - even when I’m trying to dump resoruces to disk… but FindResource() can’t find it… can someboy give compleete example how to add and load resource in code?

Thank you.

Not sure why you’re using the COPYRES or RESFILE directives, they don’t change compilation. What does the build log file have in terms of invoking rc.exe? Does your rc file actually contain anything? If so, what types of resources/

d

debt from my phone


From: xxxxx@gmail.com
Sent: 11/28/2011 6:02 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] resource files in ddk

Hello,

I’ve got a problem with adding resources to my application compiled with ddk.
In vs I’ve added new exe file by clicking right on project -> add resource then import and I added my exe file.

Now in my source file I’ve added

SOURCES=source.c \
RESOURCE.rc

COPYRES=1
RESFILE=$(TARGETNAME).res

and it seems that generated executable has this resource - even when I’m trying to dump resoruces to disk… but FindResource() can’t find it… can someboy give compleete example how to add and load resource in code?

Thank you.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Probably you specify a wrong language code to FindResource.
Open this exe with Visual Studio and look at its resources.
– pa

On 28-Nov-2011 16:05, xxxxx@gmail.com wrote:

Hello,

I’ve got a problem with adding resources to my application compiled with ddk.
In vs I’ve added new exe file by clicking right on project -> add resource then import and I added my exe file.

Now in my source file I’ve added

SOURCES=source.c \
RESOURCE.rc

COPYRES=1
RESFILE=$(TARGETNAME).res

and it seems that generated executable has this resource - even when I’m trying to dump resoruces to disk… but FindResource() can’t find it… can someboy give compleete example how to add and load resource in code?

Thank you.

Guys thaks for your input.
Here is what I’m doing.

  1. in VS I’m adding add reosurce->import and importing file.
  2. in rcfile I’m changing all afxres.h to winres.h
  3. in sources file I’m adding rc file to SOURCES
  4. perform compilation and I see that app has grather size
  5. code for dump on disk looks like this:

HGLOBAL hResLoad; // handle to loaded resource
HRSRC hRes; // handle/ptr. to res. info. in hExe

hRes = FindResource(NULL, MAKEINTRESOURCE(IDR_RES1), L"RES");
if (hRes == NULL)
{
printf(“ERROR. %d”, GetLastError());
return 1;
}

hResLoad = LoadResource(NULL, hRes);
if (hResLoad == NULL)
{
printf(“ERROR”);
return 2;
}

//…

Running this code generates error 0x715

rc file looks like this:

// Microsoft Visual C++ generated resource script.
//
#include “resource.h”

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include “winres.h”

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// Polish resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
#pragma code_page(1250)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
“resource.h\0”
END

2 TEXTINCLUDE
BEGIN
#include ““winres.h””\r\n”
“\0”
END

3 TEXTINCLUDE
BEGIN
“\r\n”
“\0”
END

#endif // APSTUDIO_INVOKED

/////////////////////////////////////////////////////////////////////////////
//
// RES
//

IDR_RES1 RES “PATH_TO_RESOURCE”
#endif // Polish resources
/////////////////////////////////////////////////////////////////////////////

#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//

/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

What’s wrong?
Probably I should generate everything in differentway. - can you point me out how to do this?

Thanks!