开发者

How do I use Resources manually?

开发者 https://www.devze.com 2023-03-12 15:04 出处:网络
I am using a VC++ 2005 express, which does not have a resource editor. Therefore, I want to know if there\'s a way to use resources manually? Do I really have to ma开发者_运维问答ke an .rc files to wo

I am using a VC++ 2005 express, which does not have a resource editor. Therefore, I want to know if there's a way to use resources manually? Do I really have to ma开发者_运维问答ke an .rc files to work with resources? I mean, can't I just import it like how fstream C++ does?


There are several free resource editors available:

  • XN resource editor
  • ResEdit

to name but two. For a resource compiler, there is the minimalistic GNU windres.


I would recommend ResHacker or a text editor for building the resources and GoRC for compiling them


Couple of options:

  • You could download the full Windows SDK, which is free and contains the official C and C++ compilers, as well as the resource compilers.
  • If you are a university student, you can download a full version of Visual Studio from MSDNAA.
  • If you are a student where MSDNAA is not available, you can still get the full copy from DreanSpark.
  • You could purchase the full version of Visual Studio -- I'm assuming this is probably cost prohibitive.

Assuming you go with the Windows SDK route, you write a resource script and pass it to the rc tool.

(Not sure why you're still using 2005 Express though given that 2010 Express is out...)


If you want to do it the hard way, the Windows API provides functions for both reading and writing resources. Have a look at UpdateResource.


A full answer to this question depends on the type of resources you are trying to create. One option for windows and dialog boxes is to ignore resources completely and create what you need with RegisterClassEx, CreateWindow, SetWindowLongPtr and a couple of other functions.

Sometimes this route feels easier than using a resource file if you are creating resizable content.

0

精彩评论

暂无评论...
验证码 换一张
取 消