News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Adding resources

Started by temujin, August 25, 2007, 10:57:56 PM

Previous topic - Next topic

temujin


Dear Forum,

Newcomer here...sorry if I have posted in the wrong forum, or if this is not really about C::B.

I´m trying to grasp the Win32 API, coding under XP, using Code::Blocks IDE and the resource editor "Resource editor 1.1.4.2" http://www.radasm.com/resed/

With the resource editor I have created a resource file containing two new icons (16x16 and 32x32) called IDI_NEWICON.

Now, renaming the .rc resource file to xrc (for use with Code::Blocks) I add this file to my Win32 project, which consists of nothing more than a window.

In the main file I change the WinMain to

wincl.hIcon = LoadIcon (hThisInstance, MAKEINTRESOURCE(IDI_NEWICON));
...and the "wincl.hIconSm" accordingly.

Compiling I get the error message:
error 'IDI_NEWICON' undecleared (first use this function)

I suspect that I need to add another header file or something , but what should be in it ?
Any suggestions would be appreciated

regards
t.

TDragon

This isn't really about C::B, but I'll answer it anyway.

A good resource editor will usually automatically create (or have the option to create) a header file containing integer defines for the identifiers -- i.e. "#define IDI_NEWICON 1001", or similar. Find this header file (or create it if you can't have it automatically created), and #include it where necessary.
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

JGM

Quote from: temujin on August 25, 2007, 10:57:56 PM
Now, renaming the .rc resource file to xrc (for use with Code::Blocks)

Try not renaming the file to xrc extension leave the rc extension. codeblocks automatically detect the rc extension as a resource and compile it with the right tool.

temujin

Thanks,

Now it worksperfectly...

:D

t.