# Some WIN32 Help - resource Files in MSVC Express

This topic is 3953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
In your resource.h file (Shown below) you used the preprocessor to
hide the contents (All the #defines) unless __IDMFILE__ is defined.

In other words...
 //...only include the following code if __IDMFILE__ is defined...#ifdef __IDMFILE__#define IDM_FILE 40001#define IDM_EDIT 40002#define IDM_FILE_NEW 40003#define IDM_FILE_OPEN 40004#define IDM_MAIN 40005#define IDM_FILE_SAVE 40006#define IDM_FILE_SAVE_AS 40007#define IDM_EDIT_UNDO 40008#define IDM_EDIT_CUT 40009#define IDM_EDIT_COPY 40010#define IDM_EDIT_PASTE 40011#define IDM_EDIT_CLEAR 40012#endif

You have to #define __IDMFILE__ before including the file
(Or use inclusion guards, and take the #ifdef out)...
#define __IDMFILE__ //Have to insure this is defined because the #ifdef                    // in resource.h#include "resource.h"

I suspect this is the problem. After fixing the above,
it should work just fine.

##### Share on other sites
Thanks, i'll take a look, i just wrote something there and i didn't know what i was doing, so i'll play with it, thanks!

##### Share on other sites
Okay i cant figure this out, can someone point me in the right direction as far as a tutorial or something about writing resource files and resource.h files?

I'm not formatting it right or something... Or even if anyone could show an example of a resource file and resource.h file.

I dunno how to properly format it and that seems to be the problem

Thanks!

##### Share on other sites
Heres the format I always use...

Here is resource.h:
#ifndef RESOURCE_H_INCLUDED#define RESOURCE_H_INCLUDED#if defined (_MSC_VER) && (_MSC_VER >= 1020)#pragma once#endif// ...Put your resource ID's here...#endif

resource.rc:
#include "resource.h"// resources

You have to also inssure to include the files in your project so the resource
compilier (and linker) could produce (and link) the *.res file with the
rest of the project.

You can do this by right-clicking the project (In solution explorer),
and select Add->Existing item and then select your *.rc file in the
project (along with your *.h file)

Everythng should work then.