News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

rc.exe, control styles

Started by locche, January 14, 2009, 09:05:09 PM

Previous topic - Next topic

locche

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

MichaelW

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.

eschew obfuscation

locche

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

MichaelW

The misleading "invalid control type" description is what led me to the missing commas.

eschew obfuscation

BlackVortex

What is your rc.exe version ?
Mine is "6.0.5724.0"

locche

#5
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.