flat assembler
Message board for the users of flat assembler.

Index > Windows > How to add CLASS to a dialog box

Author
Thread Post new topic Reply to topic
alonso



Joined: 06 Aug 2003
Posts: 15
alonso 05 Dec 2003, 14:48
Hi, every body

I'm trying to create a dialog box with the features of a relugar window, in order to do so I found a sample code for MASM on the net but the problem is the dialog macro from FASM doesn't include the class section for dialog boxes, can some one please tell me how to do it, I don't understand how macros work exactly.

MASM code:
MyDialog DIALOG 10, 10, 205, 60
STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX |
WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK
CAPTION "Our First Dialog Box"
CLASS "DLGCLASS"
Post 05 Dec 2003, 14:48
View user's profile Send private message Reply with quote
alonso



Joined: 06 Aug 2003
Posts: 15
alonso 06 Dec 2003, 23:32
After several hours of searching on the net and playing arround with the macro called dialog in the file called Resource.inc in the fasm\include\macro folder I finally found it, this is the code:

macro dialog label,clase,title,x,y,cx,cy,style,menu,exstyle,fontname,fontsize
{ local data,size,items
label dd RVA data,size,0,0
data dd style or DS_SETFONT,exstyle +0
dw items,x,y,cx,cy
if menu+0 <> 0
dw 0FFFFh
end if
du menu+0
du clase,0
du title,0
if fontname eq
du 8,'MS Sans Serif',0
else
du fontsize+0,fontname,0
end if
align 4
dialog_size equ size = $ - data
dialog_items equ items = dialog_items_counter
dialog_items_counter = 0
}

And the way to call it would be like this:

section '.rsrc' resource data readable

directory RT_DIALOG,dialogs

resource dialogs,\
37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration

dialog demonstration,'My Class','Our First Dialog Box',10,10,205,60,0x0004+DS_CENTER+WS_CAPTION+WS_MINIMIZEBOX+WS_SYSMENU+WS_VISIBLE+WS_OVERLAPPED+DS_MODALFRAME+DS_3DLOOK
dialogitem 'EDIT','',ID_CAPTION,15,17,111,13,WS_VISIBLE+ES_AUTOHSCROLL+ES_LEFT+WS_TABSTOP
dialogitem 'BUTTON','Say Hello',ID_ICONINFORMATION,141,10,52,13,WS_VISIBLE+WS_TABSTOP
dialogitem 'BUTTON','E&xit',ID_CANCEL,141,26,52,13,WS_VISIBLE+WS_TABSTOP
enddialog
Post 06 Dec 2003, 23:32
View user's profile Send private message Reply with quote
silkodyssey



Joined: 02 Oct 2003
Posts: 198
Location: St.Vincent & the Grenadines
silkodyssey 07 Dec 2003, 05:12
alonso,

Nice work with the macro. I haven't tested it as yet but if it works for you I don't see why it won't for me. I've had this problem before but with fasm's new feature to include binary resources we won't need the resource macros anymore Smile.

_________________
silkodyssey
Post 07 Dec 2003, 05:12
View user's profile Send private message MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.