News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Masm64 SDK and Pelle's C resource compiler

Started by jj2007, September 19, 2023, 09:18:53 PM

Previous topic - Next topic

jj2007

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?

TimoVJL

May the source be with you

jj2007

Yes, Timo, that is what I am using. So why does it not work?

wjr

Within MENU you could use MENUITEM SEPARATOR. Within MENUEX you would need that form, but a -1 is missing between the commas.

jj2007

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:

six_L

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
Say you, Say me, Say the codes together for ever.

jj2007

Thanks, six_L - our posts crossed, see above.

Vortex

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
  }
}

Vortex

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

jj2007

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?

Vortex

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.

jj2007

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: