The MASM Forum

Projects => Rarely Used Projects => GoAsm => Topic started by: shankle on April 28, 2013, 09:48:12 PM

Title: Dialog code
Post by: shankle on April 28, 2013, 09:48:12 PM
What is wrong with this code in a GoAsm 32-bit program? 

unknown numonic, instruction, redefinition or directive:-
          Dialog "PICK ONE ITEM TO EXECUTE",\
                   "ms sans serif",4,\
                   WS_OVERLAPPED or WS_SYSMENU or DS_CENTER,\
                   11,0,0,230,75,1024
Title: Re: Dialog code
Post by: dedndave on April 28, 2013, 10:29:00 PM
i think "Dialog" is a macro
so, we need to see the macro   :P

but, you can create the dialog with one of the create API's
Title: Re: Dialog code
Post by: MichaelW on April 28, 2013, 10:29:28 PM
That looks like a dialog definition for the MASM32 in-memory dialog macros. These macros allow you to easily construct a dialog template in memory, and then create a dialog from the template. If you have a MASM32 installation, see \masm32\include\dialogs.inc. These MASM macros obviously will not work with GoAsm, but you can create a dialog template resource, either with a resource editor or manually, and then create your dialog from that. If you specifically want to construct the template in memory, I created a procedure-based in-memory dialog system for GeneSys that I think could reasonably be translated to GoAsm syntax.
Title: Re: Dialog code
Post by: shankle on April 28, 2013, 11:53:38 PM
Thanks Guys,
Been awhile since I wrote this program in Masm32.
Forgot that Dialog is a macro. So naturally it won't work in GoAsm.
MichaelW, if you would be so kind as to include your version I will try converting
it to my needs.
Title: Re: Dialog code
Post by: MichaelW on April 29, 2013, 01:58:20 AM
AFAIK the attachment is the original distribution from 2008.
Title: Re: Dialog code
Post by: Vortex on April 29, 2013, 04:47:12 AM
Hi shankle,

The trick is to create a binary resource template based on the correct parameters.
Title: Re: Dialog code
Post by: dedndave on April 29, 2013, 07:48:29 AM
unless you absolutely need to build it in memory, using a resource file is probably simpler   :P
Title: Re: Dialog code
Post by: MichaelW on April 29, 2013, 10:55:11 AM
Quote from: dedndave on April 29, 2013, 07:48:29 AM
unless you absolutely need to build it in memory, using a resource file is probably simpler   :P

It depends on what you are doing. For complex dialogs there is no question that using a resource editor to create the template is the fastest and simplest method available. But assuming that you have an efficient system for creating the template in memory, for small simple dialogs you can define the dialog directly in your source with just a few lines of code, and edit the definition, without leaving your editor. And assuming that you specify the style bits with the defined constants, instead of lumping them together in a hex number as most resource editors do, you can just look at the definition and know which style bits are set.

Title: Re: Dialog code
Post by: jj2007 on April 29, 2013, 03:22:52 PM
Quote from: MichaelW on April 29, 2013, 10:55:11 AMfor small simple dialogs you can define the dialog directly in your source with just a few lines of code

Not to mention some really simple macros (http://masm32.com/board/index.php?topic=697.0) ;-)
Title: Re: Dialog code
Post by: shankle on May 03, 2013, 12:48:10 AM
         5-2-2013
   This concerns the "DUS" instruction in GoAsm 32-bit
   The following sample checks out OK up to the 1st
   DUS instruction then hangs.
   Thanks for any help given.

        invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,1024
        mov esi, eax
        mov edi, esi       
        mov D[edi+0],DS_SETFONT or WS_OVERLAPPED or WS_SYSMENU or DS_CENTER
        mov W[edi+8],11
        mov W[edi+10],0
        mov W[edi+12],0
        mov W[edi+14],230
        mov W[edi+16],75
        add edi,22
?       DUS L'Pick one item to execute',0       
        mov W[edi],4      ; size
        add edi, 2
?       DUS L'ms sans serif',0
Title: Re: Dialog code
Post by: jj2007 on May 03, 2013, 01:16:02 AM
If it was Masm I'd say it's not a good idea to execute a Unicode string...
Title: Re: Dialog code
Post by: Donkey on May 03, 2013, 01:33:33 AM
DUS is Define Unicode String, it should be in the data section and not inline in your code.