Author Topic: Resources  (Read 7292 times)

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
Resources
« on: February 05, 2006, 04:32:00 pm »
Hello all, I'm new here. Code::Blocks is great, but I have one problem.

I have Icon's and Menu's that I want to place in a resource file. The Icon I define with LoadImage...

But I couldn't find anything in the editor to do something with resources.

What extension should a resource have?
How to 'link' them to your file?
A comprehensive question: What and how with resources.

I hope someone can answer here, I tried the DevShed forum, but they didn't knew anything about resources in Code::Blocks.

Decrius
Check out my website: http://www.daevius.com

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Resources
« Reply #1 on: February 05, 2006, 04:51:03 pm »
The underlying structure for Win32 resources in any IDE is the .rc file. In Code::Blocks, if you add a file with the .rc extension to your project, it will be compiled with the resource compiler and linked into your program.

Unfortunately I've never come across a good reference for the structure of a .rc file (maybe someone else can chime in here?); I just learned by looking at the contents of the files Visual Studio produces.

Also, I've started using wxWidgets for all my GUI development, which sits on top of all the Win32 functionality and uses a different format for its resources, and is in my humble opinion far and away easier to work with.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
Re: Resources
« Reply #2 on: February 05, 2006, 04:53:26 pm »
Okay, thank you, with project you mean just a .c file? Or that thing they put into the program which does everything except what I need (GUI project thing)?
Check out my website: http://www.daevius.com

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
Re: Resources
« Reply #3 on: February 05, 2006, 04:59:24 pm »
I tried the console application project, deleted the main.c, added the .c file of my GUI program, added the resource file (.rc). But when I try to compile (is that the same as 'build'?) it says in the build log:

gcc: Files\CodeBlocks\include\taco\resources\resource.rc: No such file or directory
gcc: warning: `-x c' after last input file has no effect
gcc: no input files
windres.exe: no resources
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 1 warnings

While I selected the resource from the list!

Decrius
Check out my website: http://www.daevius.com

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
Re: Resources
« Reply #4 on: February 05, 2006, 05:14:17 pm »
I think I got it working, maybe project are better than I thought :D

Decrius
Check out my website: http://www.daevius.com

Offline kkez

  • Almost regular
  • **
  • Posts: 153
    • WinapiZone
Re: Resources
« Reply #5 on: February 05, 2006, 05:22:58 pm »
Unfortunately I've never come across a good reference for the structure of a .rc file (maybe someone else can chime in here?);

Resource definition statement.

Oh, hi Decrius  :P
« Last Edit: February 05, 2006, 05:25:20 pm by kkez »

Offline kkez

  • Almost regular
  • **
  • Posts: 153
    • WinapiZone
Re: Resources
« Reply #6 on: February 05, 2006, 06:00:54 pm »
btw, my .rc file no longer have the syntax highlighting even if the filemask for the lexer is .rc... (bug?)

Now, if i change the highlight mode in the edit menu, all the [ + ] to unfold the blocks of code disappear even if the line count remains the same. I just can't unfold it again  :( (bug?)

EDIT: wait, all the lexers switched by one from the D lexers: the D lexer has the fortran77 filemask and so on... better go look inside the default.conf file...
« Last Edit: February 05, 2006, 06:05:58 pm by kkez »

takeshimiya

  • Guest
Re: Resources
« Reply #7 on: February 05, 2006, 06:35:19 pm »
btw, my .rc file no longer have the syntax highlighting even if the filemask for the lexer is .rc... (bug?)

Now, if i change the highlight mode in the edit menu, all the [ + ] to unfold the blocks of code disappear even if the line count remains the same. I just can't unfold it again  :( (bug?)

EDIT: wait, all the lexers switched by one from the D lexers: the D lexer has the fortran77 filemask and so on... better go look inside the default.conf file...

That's a bug: the lexers are indexed by IDs.

Offline kkez

  • Almost regular
  • **
  • Posts: 153
    • WinapiZone
Re: Resources
« Reply #8 on: February 06, 2006, 12:12:04 pm »
everything is fine now, i just deleted everything between <color_sets> and </color_sets>. Maybe in the previous revision the lexers were read in the order they are and my conf file still had the old list...

takeshimiya

  • Guest
Re: Resources
« Reply #9 on: February 06, 2006, 07:18:37 pm »
everything is fine now, i just deleted everything between <color_sets> and </color_sets>. Maybe in the previous revision the lexers were read in the order they are and my conf file still had the old list...
Yes, that's because they're being indexed by IDs, which will screw up all the lexers when a new lexer get's added. :)