### Author Topic: Dialog code  (Read 7231 times)

#### shankle

• Member
• Posts: 847
##### Dialog code
« 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,\
11,0,0,230,75,1024

#### dedndave

• Member
• Posts: 8825
• Still using Abacus 2.0
##### Re: Dialog code
« Reply #1 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

#### MichaelW

• Global Moderator
• Member
• Posts: 1209
##### Re: Dialog code
« Reply #2 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.
Well Microsoft, here’s another nice mess you’ve gotten us into.

#### shankle

• Member
• Posts: 847
##### Re: Dialog code
« Reply #3 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.

#### MichaelW

• Global Moderator
• Member
• Posts: 1209
##### Re: Dialog code
« Reply #4 on: April 29, 2013, 01:58:20 AM »
AFAIK the attachment is the original distribution from 2008.
Well Microsoft, here’s another nice mess you’ve gotten us into.

#### Vortex

• Member
• Posts: 2104
##### Re: Dialog code
« Reply #5 on: April 29, 2013, 04:47:12 AM »
Hi shankle,

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

#### dedndave

• Member
• Posts: 8825
• Still using Abacus 2.0
##### Re: Dialog code
« Reply #6 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

#### MichaelW

• Global Moderator
• Member
• Posts: 1209
##### Re: Dialog code
« Reply #7 on: April 29, 2013, 10:55:11 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

• Member
• Posts: 10091
• Assembler is fun ;-)
##### Re: Dialog code
« Reply #8 on: April 29, 2013, 03:22:52 PM »
for 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

• Member
• Posts: 847
##### Re: Dialog code
« Reply #9 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
?       DUS L'Pick one item to execute',0
mov W[edi],4      ; size
?       DUS L'ms sans serif',0

#### jj2007

• Member
• Posts: 10091
• Assembler is fun ;-)
##### Re: Dialog code
« Reply #10 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...

#### Donkey

• Moderator
• Member
• Posts: 201
• ASS-embler
##### Re: Dialog code
« Reply #11 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.
"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