News:

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

Main Menu

Dialog code

Started by shankle, April 28, 2013, 09:48:12 PM

Previous topic - Next topic

shankle

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

dedndave

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

MichaelW

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.
Well Microsoft, here's another nice mess you've gotten us into.

shankle

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.

MichaelW

AFAIK the attachment is the original distribution from 2008.
Well Microsoft, here's another nice mess you've gotten us into.

Vortex

Hi shankle,

The trick is to create a binary resource template based on the correct parameters.

dedndave

unless you absolutely need to build it in memory, using a resource file is probably simpler   :P

MichaelW

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.

Well Microsoft, here's another nice mess you've gotten us into.

jj2007

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 ;-)

shankle

         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

jj2007

If it was Masm I'd say it's not a good idea to execute a Unicode string...

Donkey

DUS is Define Unicode String, it should be in the data section and not inline in your code.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable