SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

It removes the #include <windows.h> everytime I save

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> Resource Builder
View previous topic :: View next topic  
Author Message
dit6a9



Joined: 01 Aug 2004
Posts: 4

PostPosted: Sun Aug 08, 2004 6:49 am    Post subject: It removes the #include <windows.h> everytime I save Reply with quote

I'm working on the following resource:
Code:
#include <windows.h>

/*********************************************
File: C:\MIS C\20040807\SETUP01\DIALOGBOXES.RC
Generated by Resource Builder 2.0.
*********************************************/
// Below are important 3 lines, don't change them!
/*
OutputExt=res
*/
DIALOG_0 DIALOG 0, 0, 421, 188
STYLE DS_SETFONT |WS_CHILD
FONT 8, "Tahoma"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
  CONTROL "Button0",0,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,250,165,149,17
  CONTROL "",1,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,20,7,380,151
END

Everything goes fine. Resource Builder reads it perfectly (At last I get it! I had problems with the windows.h file as I wrote before. It seems I had to add the _MSC_VER compiler definition in the compiler options). But when I save the .rc file, it removes the #include <windows.h>. This is a problem as long as that include is needed later so that my proyect compiles with no errors.

Is it normal? Can't I use any include directive in the .rc files? I don't know, maybe I shouldn't use the #include <windows.h> in the .rc file but if I don't do it, I can't compile the proyect. Maybe the mistake lies in the other part, I mean in the way I compile the whole application.

I would be very grateful if someone could help me. Thanks in advance.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Mon Aug 09, 2004 5:57 am    Post subject: Reply with quote

Resource Builder's compiler removes all <#include> directives after parsing so the file saved by Resource Builder won't have them. But in order to be able to compile the project that uses this RC file you may do the following:
1. Create new RC file using text editor with the following content:
Code:
#include <windows.h>
#include <YOUR_RC_FILE_FROM_RESOURCE_BUILDER.RC>

2. Use this file in your project instead of actual RC file and use actual RC file in Resource Builder.

This way you will be able to handle the situation.
Hope this helps.
Back to top
View user's profile Send private message
dit6a9



Joined: 01 Aug 2004
Posts: 4

PostPosted: Mon Aug 09, 2004 7:09 pm    Post subject: Reply with quote

You're right. That way it all works out well. Many thanks.

But I've got another probem/question.

I'd like to use names instead of numbers in order to indetify the different controls. Something like this:
Code:
/*********************************************
#include "resorces.h"
 
File: C:\MIS C\20040807\SETUP01\DIALOGBOXES.RC
Generated by Resource Builder 2.0.
*********************************************/
// Below are important 3 lines, don't change them!
/*
OutputExt=res
*/
DIALOG_0 DIALOG 0, 0, 421, 188
STYLE DS_SETFONT |WS_CHILD
FONT 8, "Tahoma"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
  CONTROL "Button0",BUTTON_STARTDOWNLOADING,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,250,165,149,17
  CONTROL "",1,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,20,7,380,151
END


where resources.h is:
Code:
#define BUTTON_STARTDOWNLOADING 0


This is just an example. Can't I do this with Resource Builder? Probably the first time I try to open this .rc no errors will happen, but if the resource.h is removed, next time it won't work.

Is there any workaround to solve this?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Tue Aug 10, 2004 3:56 am    Post subject: Reply with quote

Unfortunately, this is not possible. Resource Builder will replace all named (literal) constants with their values on first reading and on later saving will save RC file with only integer IDs. There is no workaround for this (or at least I don't know it Wink)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> Resource Builder All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group