This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: windres and an icon in a dialog


Sascha Ziemann <szi@khs-ag.de> writes:
> Hi,
> 
> I am doing my fist W32 programming steps with a mingw32 cross
> compiler.  I tried an example from Charles Petzold's "Windows
> Programming":
> 
> 42 ABOUT_WINDOW DIALOG DISCARDABLE 32, 32, 180, 100
> 43 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
> 44 CAPTION "The caption"
> 45 FONT 8, "MS Sans Serif"
> 46 BEGIN
> 47      DEFPUSHBUTTON   "Ok", IDOK, 66, 80, 50, 14
> 48      ICON            "ABOUT1", IDC_STATIC, 7, 7, 21, 20
> 49      CTEXT           "First text", IDC_STATIC, 40, 12, 100, 8
> 50      CTEXT           "Second text", IDC_STATIC, 7, 52, 166, 8
> 51 END
> 52 
> 53 ABOUT1 ICON DISCARDABLE "an_icon.ico"
> 
> When I try to compile it, I get the following error:
> 
> i386-mingw32msvc-windres: resources.de.rc:49: parse error
> 
> The error message is quite short.  Does anybody know what is wrong
> with the code?

Windres here is following Microsoft's spec[1] for the ICON control 
statement and correctly rejecting this statement per spec. However, 
MS RC compiler seems to accept this, and a lot of the books have used 
this simply because it works (to be correct, it needs a ICON_STYLE 
parameter in addition to the 4 numbers you have there). 

I'll fix the incompatibility for the next release, but till then, you
can do the following (works for MS compiler as well):

 ICON "ABOUT1", IDC_STATIC, 7, 7, 21, 20, 0

where the last 0 just "or"s 0 to the list of current styles. FYI, this
is equivalent to:

 ICON "ABOUT1", IDC_STATIC, 7, 7, 21, 20, SS_ICON | WS_CHILD | WS_VISIBLE
 
Regards,
Mumit

[1] See "windres - Resource-Definition Statements"
    http://msdn.microsoft.com/library/psdk/winui/rc_35rn.htm


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]