This is my 1st attempt at creating a resource file in GoAsm.
I know about the Resource Compile Manual. But truthfully it is a bit of a mystery
at the present time. Below is a sample of my GoAsm batch file and the items I need for
the GoAsm 64-bit program that I am working on in MASM32 format.
For EX: I assume I put a line in the batch file that will compile the items I
need in the 64-bit program.
Sure could use some "GET STARTED" advice....
Thanks for any guidence.
GoAsm Batch file
Set INCLUDE= J:\codejps
Set PATH=J:\codejps
GoAsm /x64/b/c blah.asm
GoLink /unused blah.obj
MASM32 res file
#define IDM_CUT 1101
#define IDM_COPY 1102
#define IDM_PASTE 1103
#define IDM_FIND 1104
#define IDM_UNDO 1105
#define IDM_EXIT 1010
600 MENUEX MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
POPUP "&File", , , 0
BEGIN
MENUITEM "&Exit", IDM_EXIT
END
POPUP "&Edit", , , 0
BEGIN
MENUITEM "C&ut", IDM_CUT
MENUITEM "COPY", IDM_COPY
MENUITEM "PASTE", IDM_PASTE
MENUITEM "&FIND", IDM_FIND
MENUITEM "UNDO", IDM_UNDO
END
END
I think this should work:
Set INCLUDE= J:\codejps
Set PATH=J:\codejps
GoAsm /x64/b/c blah.asm
GoRC /machine x64 /r blah.rc
GoLink /unused blah.obj blah.res
Thank you Yuri for responding.
The GoRC command line format is:
GoRc[command line switches] filename[.ext]
Unless I have an old version if the manual it is different from
what you stated.
For example: what is Machine x64.
Blah is the name of the 64-bit program so I assume something
like "ResFile.rc" would go there.
Also there is the problem of how to convert the above MASM32 res file to
GoAsm 64-bit.
Hi shankle,
A quick way is to use Pelle's resource editor. It can save your resource as .rc and .res files.
machine x64 is a command line switch telling GoRC that the output file must be 64-bit. I tried to feed your source to GoRC and it compiled it without complaints, so probably you don't even have to edit anything in your source. Of course you can give any name to the source file.
Thanks guys.
Once I get a working example, then I can go back to the RC Manual and
maybe it will make more sense.
7-2-2014
Hope I have included all the necessary items.
If Not I will supply more if needed.
Obviously I am having names problems.
Not sure if anything else.
Have no idea how to code the name in the resfile script.
Here are the GoRC errors:
Line 1 of Resource Script {resfile}
An ID was not evaluated and was assumed to be a name.
Line 1 of Resource Script {resfile}
A resource type was not recognized and assumed to be
used-defined-Main.
ERROR!
Line 1 of Resource Script {resfile}.
Could not find File- resfile
Res file not made
; resbatch
Set INCLUDE= J:\codejps
Set PATH=J:\codejps
GoAsm /x64/b/c blah1.asm
GoRC /machine x64 /r resfile.rc
GoLink /unused blah1.obj
id_menu main resfile ; This gave a compile error
#define IDM_CUT 1101
#define IDM_COPY 1102
#define IDM_PASTE 1103
#define IDM_FIND 1104
#define IDM_UNDO 1105
#define IDM_EXIT 1010
600 MENUEX MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
POPUP "&File", , , 0
BEGIN
MENUITEM "&Exit", IDM_EXIT
END
POPUP "&Edit", , , 0
BEGIN
MENUITEM "C&ut", IDM_CUT
MENUITEM "COPY", IDM_COPY
MENUITEM "PASTE", IDM_PASTE
MENUITEM "&FIND", IDM_FIND
MENUITEM "UNDO", IDM_UNDO
END
END
Changes in the 64-bit res usage program
resfile db 'resbtch',0
.const
menuname equ 600
IDM_CUT equ 1101
IDM_COPY equ 1102
IDM_PASTE equ 1103
IDM_FIND equ 1104
IDM_UNDO equ 1105
IDM_EXIT equ 1010
IDOK equ 1
IDCANCEL equ 2
mov Q[ovl.lpszMenuName],offset resfile
invoke LoadMenu, [hInst],[menuname] ; not sure if menuname is correct
invoke SetMenu, [hWnd],rax
invoke GetSubMenu, rax,0
mov Q[hMenu],rax
WinMain:
FRAME hInst,hPrevInst,CmdLine,CmdShow
LOCAL ovl:WNDCLASSEX,msg,RR:RECT,hWndEX
Local ps:PAINTSTRUCT,hBrush,hdc,hMenu
WndProc:
FRAME hWnd,iMsg,wParam,lParam
LOCAL ovl:WNDCLASSEX,hInst,hMenu
Local hdc
i don't know how the GoAsm files are organized
but, for masm32, we use a Resource.h file that has many common constants defined
so, the first line in one of my resource files is usually
#include "\masm32\include\resource.h"
you'll have to sort out how to add it for GoAsm (correct path)
after that, a resource file might look like this
#define ID_MENU_MAIN 600
#define IDM_CUT 1101
#define IDM_COPY 1102
#define IDM_PASTE 1103
#define IDM_FIND 1104
#define IDM_UNDO 1105
#define IDM_EXIT 1010
ID_MENU_MAIN MENUEX MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
POPUP "&File", , , 0
BEGIN
MENUITEM "&Exit", IDM_EXIT
END
POPUP "&Edit", , , 0
BEGIN
MENUITEM "C&ut", IDM_CUT
MENUITEM "COPY", IDM_COPY
MENUITEM "PASTE", IDM_PASTE
MENUITEM "&FIND", IDM_FIND
MENUITEM "UNDO", IDM_UNDO
END
END
then, in the ASM source
ID_MENU_MAIN equ 600
IDM_CUT equ 1101
IDM_COPY equ 1102
IDM_PASTE equ 1103
IDM_FIND equ 1104
IDM_UNDO equ 1105
IDM_EXIT equ 1010
IDOK equ 1
IDCANCEL equ 2
to load the menu.....
notice, in the documentation for LoadMenu...
HMENU WINAPI LoadMenu(
_In_opt_ HINSTANCE hInstance,
_In_ LPCTSTR lpMenuName
);
QuotelpMenuName [in]
Type: LPCTSTR
The name of the menu resource. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. To create this value, use the MAKEINTRESOURCE macro.
well, in the world of ASM, we don't really need to use a MAKEINTRESOURCE macro :biggrin:
what that text is really saying is
1) of lpMenuName is less than 65536, it's an integer identifier (600, in your case)
2) otherwise, it's the address of a null-terminated string (menu name)
invoke LoadMenu,[hInst],ID_MENU_MAIN ;ID_MENU_MAIN = 600
it's been a while since i read the resource help file
but, i seem to recall that MENUEX had special requirements over using MENU
i use MENUEX if i am using accelerators or something
well - if it doesn't work for you, read the MENUEX documentation carefully
Quote from: shankle on July 03, 2014, 06:22:23 AM
id_menu main resfile ; This gave a compile error
Why do you need this line? Try to remove it.
Also you forgot to link the output file of GoRC to the program. Should be:
GoAsm /x64/b/c blah1.asm
GoRC /machine x64 /r resfile.rc
GoLink /unused blah1.obj resfile.res
Or, if you prefer GoRC to make your resource into an object file rather than RES file:
GoAsm /x64/b/c blah1.asm
GoRC /machine x64 /o resfile.rc
GoLink /unused blah1.obj resfile.obj
Hi Vortex.
I looked for Pelle's resource editor but was unable to find it.
Anyway if it does not work in 64-bit it is worthless to me.
Please let me know.....
Hi shankle,
Pelle's resource editor is a built-in component of the IDE. You can get the 32-bit and 64-bit versions from :
http://smorgasbordet.com/pellesc/download.htm
Hi Vortex,
I went on the site you gave and downloaded "setup64.exe".
Lots of mention of Notepad++(which I already use).
Nothing about a res editor. Possibly I downloaded the wrong
thing.
Thanks for responding.
7-3-2014
Obviously I am having a naming problem.
Not sure if anything else.
Have no idea how to code the name in the resfile script.
Not sure if resource headers are involved in GoRC 64-bit as in Masm32.
Here are the GoRC errors:
Line 1 of Resource Script {resfile}
An ID was not evaluated and was assumed to be a name:-
ID_MENU_MAIN
Line 8 of Resource Script {resfile}
A resource type was not recognized and assumed to be
used-defined:- ID_MENU_MAIN
ERROR!
Line 8 of Resource Script {resfile}.
Could not find File - MENUEX
Res file not made
; resbatch
Set INCLUDE= J:\codejps
Set PATH=J:\codejps
GoAsm /x64/b/c blah1.asm
GoRC /machine x64 /r resfile.rc
GoLink /unused blah1.obj resfile.res
ID_MENU_MAIN_
#define IDM_CUT 1101
#define IDM_COPY 1102
#define IDM_PASTE 1103
#define IDM_FIND 1104
#define IDM_UNDO 1105
#define IDM_EXIT 1010
ID_MENU_MAIN MENUEX MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
POPUP "&File", , , 0
BEGIN
MENUITEM "&Exit", IDM_EXIT
END
POPUP "&Edit", , , 0
BEGIN
MENUITEM "C&ut", IDM_CUT
MENUITEM "COPY", IDM_COPY
MENUITEM "PASTE", IDM_PASTE
MENUITEM "&FIND", IDM_FIND
MENUITEM "UNDO", IDM_UNDO
END
END
Changes in the 64-bit res usage program
resfile db 'resbtch',0
.const
ID_MENU_MAIN equ 600
IDM_CUT equ 1101
IDM_COPY equ 1102
IDM_PASTE equ 1103
IDM_FIND equ 1104
IDM_UNDO equ 1105
IDM_EXIT equ 1010
IDOK equ 1
IDCANCEL equ 2
mov Q[ovl.lpszMenuName],offset resfile
invoke LoadMenu, [hInst],[ID_MENU_MAIN]
invoke SetMenu, [hWnd],rax
invoke GetSubMenu, rax,0
mov Q[hMenu],rax
WinMain:
FRAME hInst,hPrevInst,CmdLine,CmdShow
LOCAL ovl:WNDCLASSEX,msg,RR:RECT,hWndEX
Local ps:PAINTSTRUCT,hBrush,hdc,hMenu
WndProc:
FRAME hWnd,iMsg,wParam,lParam
LOCAL ovl:WNDCLASSEX,hInst,hMenu
Local hdc
invoke LoadMenu, [hInst],[ID_MENU_MAIN]
no braces on the constant
invoke LoadMenu, [hInst],ID_MENU_MAIN
Hi shankle,
You start Pelle's IDE and follow this path : File -> New -> Resources Now, right click untitled and select the resource type from the menu.
Hi Vortex,
I tried to follow your instructions but they didn't work for me.
Running Windows 7 pro 64-bit.
Didn't see any major heading "IDE"
Saw IDE for translations only.
Thanks
The first line of your resource file should be as follows to correspond to the value that you defined in your asm file:
#define ID_MENU_MAIN 600
7-3-2014
Now there are NO GoRc errors.
BUT no items are showing on the screen such as: cut, copy, paste etc.....
; resbatch
Set INCLUDE= J:\codejps
Set PATH=J:\codejps
GoAsm /x64/b/c blah1.asm
GoRC /machine x64 /r resfile.rc
GoLink /unused blah1.obj resfile.res
#define ID_MENU_MAIN 600
#define IDM_CUT 1101
#define IDM_COPY 1102
#define IDM_PASTE 1103
#define IDM_FIND 1104
#define IDM_UNDO 1105
#define IDM_EXIT 1010
ID_MENU_MAIN MENUEX MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
POPUP "&File", , , 0
BEGIN
MENUITEM "&Exit", IDM_EXIT
END
POPUP "&Edit", , , 0
BEGIN
MENUITEM "C&ut", IDM_CUT
MENUITEM "COPY", IDM_COPY
MENUITEM "PASTE", IDM_PASTE
MENUITEM "&FIND", IDM_FIND
MENUITEM "UNDO", IDM_UNDO
END
END
Changes in the 64-bit res usage program
resfile db 'resfile.rc',0
.const
ID_MENU_MAIN equ 600
IDM_CUT equ 1101
IDM_COPY equ 1102
IDM_PASTE equ 1103
IDM_FIND equ 1104
IDM_UNDO equ 1105
IDM_EXIT equ 1010
IDOK equ 1
IDCANCEL equ 2
mov Q[ovl.lpszMenuName],offset resfile
invoke LoadMenu, [hInst],[resfile]
invoke SetMenu, [hWnd],rax
invoke GetSubMenu, rax,0
mov Q[hMenu],rax
WinMain:
FRAME hInst,hPrevInst,CmdLine,CmdShow
LOCAL ovl:WNDCLASSEX,msg,RR:RECT,hWndEX
Local ps:PAINTSTRUCT,hBrush,hdc,hMenu
WndProc:
FRAME hWnd,iMsg,wParam,lParam
LOCAL ovl:WNDCLASSEX,hInst,hMenu
Local hdc
In the asm file I don't think you need the resfile line anymore. Changing to the following lines should do it:
mov Q[ovl.lpszMenuName], ID_MENU_MAIN
invoke LoadMenu, [hInst], ID_MENU_MAIN
To WJR,
I made the changes you suggested and it did not work.
Changed Q[ovl.lpszMenuName],600 - SUCESS.
Thanks everyone for all your help.
I had a tad of trouble with this one.