The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: locche on January 14, 2009, 09:05:09 PM

Title: rc.exe, control styles
Post by: locche on January 14, 2009, 09:05:09 PM
Hello,
I'm transcoding a c windows project to asm. I am having some trouble with the rc.file pertaining to buttons. The following code was succesfully compiled using brc32.exe, the resource compiler for Borland C++ 5.5. Rc won't do it. Error msg is "invalid control type".

DEFPUSHBUTTON  "&Get PPMs",ID_SUM, 242,50,40,20 WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_MULTILINE
PUSHBUTTON "C&lear" , ID_CLEAR, 242, 75,40,20 WS_CHILD |  WS_VISIBLE | WS_TABSTOP | BS_MULTILINE    

If I remove the extras, WS_CHILD, etc., it will compile. However, I require the BS_MULTILINE for example, because some text
exceeds the width.  Besides, I'm sure this can be done. I just don't know how.  I've seen some rc code using 0x00000002, which
has been placed after the button control proportions. I guess this may be a hex equivalent to "BS_THIS | WS_THAT". Does anyone
have an idea?

Thanks
Locche
Title: Re: rc.exe, control styles
Post by: MichaelW on January 14, 2009, 09:42:44 PM
This appears to work:

#include "\masm32\include\resource.h"
#define ID_SUM    101
#define ID_CLEAR  102
MyDialog DIALOG 0,0, 200,100
STYLE 0x0004 | DS_CENTER | WS_OVERLAPPED | WS_SYSMENU
CAPTION "XXX"
FONT 8, "MS Sans Serif"
BEGIN
  DEFPUSHBUTTON  "&Get PPMs",ID_SUM, 242,50,40,20,WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_MULTILINE
  PUSHBUTTON "C&lear" ,ID_CLEAR,242,75,40,20,WS_CHILD |  WS_VISIBLE | WS_TABSTOP | BS_MULTILINE
END


Basically, I had to include resource.h and add a comma before the style specs.

Title: Re: rc.exe, control styles
Post by: locche on January 14, 2009, 11:01:21 PM
Thanks MichaelW

I'm sorry if I have wasted your time. I think the problem is that I'm dealing with an enormous rc file, which I should sensibly be compiling dialog for dialog, not all at once.  Resource files tend to be tricky.  RC error message referred to the lines I posted. Yet the problem seems to lie elsewhere in the file... I'll figure it out.

cheers Locche
Title: Re: rc.exe, control styles
Post by: MichaelW on January 14, 2009, 11:17:33 PM
The misleading "invalid control type" description is what led me to the missing commas.

Title: Re: rc.exe, control styles
Post by: BlackVortex on January 14, 2009, 11:18:44 PM
What is your rc.exe version ?
Mine is "6.0.5724.0"
Title: Re: rc.exe, control styles
Post by: locche on January 14, 2009, 11:48:03 PM
Ver. 5.00.1823.1. Came with the masm32 package.
One problem seems to be the .res file created.  The linker demands the /subsystem:windows switch and the result is an invisible dialogbox full of visible controls. 
Sorry, the box was invisible because of my poor asm. I was returning TRUE instead of FALSE from the dialog.