The MASM Forum

Microsoft 64 bit MASM => MASM64 SDK => Topic started by: jj2007 on September 19, 2023, 09:18:53 PM

Title: Masm64 SDK and Pelle's C resource compiler
Post by: jj2007 on September 19, 2023, 09:18:53 PM
Here is part of a resource file for a simple Windows GUI template, for use with the Masm64 SDK (full project attached).
It assembles and runs fine, but I can't get the menu to work with \Masm64\bin64\porc64.exe:

IDC_MENU  MENU        // The menu
BEGIN
    POPUP "File"
    BEGIN
        MENUITEM "&New", IDM_NEW
        MENUITEM "&Open", IDM_OPEN
        MENUITEM "&Save", IDM_SAVE
        MENUITEM "", , MFT_SEPARATOR
        MENUITEM "E&xit", IDM_EXIT
    END
    POPUP "Edit"
    BEGIN
        MENUITEM "Copy", IDM_COPY
        MENUITEM "Paste", IDM_PASTE
        MENUITEM "Cut", IDM_CUT
        MENUITEM "Undo", IDM_UNDO
    END
END

Porc64 throws lots of errors, while good ol' rc.exe (at \Masm64\bin64\RC.Exe) works just fine:

*** creating rsrc.res ***
PORC: J:\Masm64\Examples\M64Gui.rc(30): warning: No newline at end of file.
PORC: J:\Masm64\Examples\M64Gui.rc(20): error: Number expected (found: ,).
PORC: J:\Masm64\Examples\M64Gui.rc(20): error: Invalid syntax.
PORC: J:\Masm64\Examples\M64Gui.rc(21): error: File not found: 'E&xit'.
PORC: J:\Masm64\Examples\M64Gui.rc(26): error: File not found: 'Paste'.
PORC: J:\Masm64\Examples\M64Gui.rc(27): error: File not found: 'Cut'.
PORC: J:\Masm64\Examples\M64Gui.rc(28): error: File not found: 'Undo'.

Any idea what the problem could be?
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: TimoVJL on September 19, 2023, 10:13:20 PM
MENUITEM "", , MFT_SEPARATOR
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: jj2007 on September 19, 2023, 10:24:56 PM
Yes, Timo, that is what I am using. So why does it not work?
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: wjr on September 20, 2023, 01:46:55 AM
Within MENU you could use MENUITEM SEPARATOR. Within MENUEX you would need that form, but a -1 is missing between the commas.
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: jj2007 on September 20, 2023, 03:26:58 AM
Quote from: wjr on September 20, 2023, 01:46:55 AMWithin MENU you could use MENUITEM SEPARATOR. Within MENUEX you would need that form, but a -1 is missing between the commas.

With MENUITEM "", -1 , MFT_SEPARATOR I get error RC2122 : unknown menu subtype with rc.exe.

Porc64 is happy with the -1 but still throws the other errors:
PORC: J:\Masm64\Examples\M64Gui.rc(30): warning: No newline at end of file.
PORC: J:\Masm64\Examples\M64Gui.rc(20): error: Invalid syntax.
PORC: J:\Masm64\Examples\M64Gui.rc(21): error: File not found: 'E&xit'.
PORC: J:\Masm64\Examples\M64Gui.rc(26): error: File not found: 'Paste'.
PORC: J:\Masm64\Examples\M64Gui.rc(27): error: File not found: 'Cut'.
PORC: J:\Masm64\Examples\M64Gui.rc(28): error: File not found: 'Undo'.

GOTCHA:
MENUITEM "", , MFT_SEPARATOR
MENUITEM SEPARATOR

... works for both resource compilers, and all Porc64 errors disappear. Wow :cool:
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: six_L on September 20, 2023, 03:47:14 AM
IDC_MENU  MENU        // The menu
BEGIN
    POPUP "File"
    BEGIN
        MENUITEM "&New", IDM_NEW
        MENUITEM "&Open", IDM_OPEN
        MENUITEM "&Save", IDM_SAVE
       [b] //MENUITEM "", , MFT_SEPARATOR[/b]
MENUITEM separator
        MENUITEM "E&xit", IDM_EXIT
    END
    POPUP "Edit"
    BEGIN
        MENUITEM "Copy", IDM_COPY
        MENUITEM "Paste", IDM_PASTE
        MENUITEM "Cut", IDM_CUT
        MENUITEM "Undo", IDM_UNDO
    END
END
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: jj2007 on September 20, 2023, 03:51:40 AM
Thanks, six_L - our posts crossed, see above.
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: Vortex on September 20, 2023, 04:08:18 AM
Hi Jochen,

Can you try the resource script below? You will need to change the paths pointing the icon and manifest file :

#include "resource.h"

IDI_APPLICATION ICON "Smiley.ico"
1 RT_MANIFEST "XpManifest.xml"

#define IDC_MENU    100
#define IDM_NEW            10
#define IDM_OPEN    11
#define IDM_SAVE    12
#define IDM_EXIT    13   
#define IDM_COPY    14
#define IDM_PASTE    15
#define IDM_CUT            16
#define IDM_UNDO    17

IDC_MENU MENU
{
  POPUP "File"
  {
    MENUITEM "&New", IDM_NEW
    MENUITEM "&Open", IDM_OPEN
    MENUITEM "&Save", IDM_SAVE
    MENUITEM "", MF_SEPARATOR
    MENUITEM "E&xit",IDM_EXIT
  }
  POPUP "Edit"
  {
    MENUITEM "Copy", IDM_COPY
    MENUITEM "Paste", IDM_PASTE
    MENUITEM "Cut", IDM_CUT
    MENUITEM "Undo", IDM_UNDO
  }
}
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: Vortex on September 20, 2023, 04:10:31 AM
Hi Jochen,

By the way, Pelle's resource compiler shipped with the Masm SDKs are very old. You can download PellesC V12 and get the version of porc.exe
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: jj2007 on September 20, 2023, 04:42:28 AM
Quote from: Vortex on September 20, 2023, 04:08:18 AMCan you try the resource script below? You will need to change the paths pointing the icon and manifest file :

Hi Erol,

Works fine with both rc and porc. The only difference is here:
yours: MENUITEM "", MF_SEPARATOR
mine:  MENUITEM SEPARATOR

Quote from: Vortex on September 20, 2023, 04:10:31 AMBy the way, Pelle's resource compiler shipped with the Masm SDKs are very old. You can download PellesC V12 and get the version of porc.exe

I'd like to keep it compatible with the Masm64 SDK. Can we convince Pelle to let it be included in the SDK download?
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: Vortex on September 20, 2023, 05:00:14 AM
Hi Jochen,

Loading the executable M64Gui.exe into Pelles IDE, I managed to extract the resources as a .rc script. The IDE's output included the following :

MENUITEM "", MF_SEPARATOR
Both of the two syntaxes are accepted by Pelles resource compiler.

Let me create a topic in Pelles forum to obtain the permisson.
Title: Re: Masm64 SDK and Pelle's C resource compiler
Post by: jj2007 on September 20, 2023, 06:21:04 AM
Quote from: Vortex on September 20, 2023, 05:00:14 AMHi Jochen,

Loading the executable M64Gui.exe into Pelles IDE, I managed to extract the resources as a .rc script. The IDE's output included the following :

MENUITEM "", MF_SEPARATOR
Both of the two syntaxes are accepted by Pelles resource compiler.

I checked once more, and these are accepted by porc and rc:
        MENUITEM SEPARATOR
        MENUITEM "&Save", IDM_SAVE
        MENUITEM "", MF_SEPARATOR

QuoteLet me create a topic in Pelles forum to obtain the permisson.

Great. Then Stewart or Mikl could add it to the Masm64 SDK (if it works fine, of course :biggrin: )

Btw rc.exe of 9 June 1998 also accepts both syntaxes and produces a fine *.res file :biggrin: