I modified default FASM resource dialog macro to (optionally) handle different fonts (default is MS Sans Serif):
macro dialog label,itemscount,title,x,y,cx,cy,style,menu,[fontname,fontsize]

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


So you can now do like:
dialog main,3,"Caption",0,0,100,100,DS_CENTER+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX,0,"Tahoma",8


Old dialog without specified font shall still work.
Posted on 2003-04-21 23:13:36 by comrade
This is very usefull,Comrade.

Also,thanks for your help about my PE file question;sorry for being late.
Posted on 2003-04-22 02:52:29 by Vortex
I can't get this working..... I can use the macro without defining the font and the size, but when I do so using the line below, I get an error :(:
dialog demonstration,13,'Create message box',70,70,190,175,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME,'Tahoma',8

....Else it seems to be great... ;)
Posted on 2003-04-22 10:51:45 by Tommy
You need to overwrite the macro in your resource.inc.
Posted on 2003-04-22 11:30:44 by comrade
I have done that.... (of course :))....but it still doesn't work... :(
Posted on 2003-04-22 11:36:21 by Tommy
I found the error.... I forgot to fill out the menu argument... :) thanks!

....do you know how to add exstyle to the dialog too?
Posted on 2003-04-22 11:39:47 by Tommy
Yes, I have made some further adjustment to dialog macro:
macro dialog label,itemscount,title,x,y,cx,cy,style,menu,[exstyle,fontname,fontsize]

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


This time you would need to specify exstyle before fontname and fontsize, so your new call to dialog macro will look something like this:
dialog main,3,"Caption",0,0,100,100,DS_CENTER+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX,0,WS_EX_TOOLWINDOW,"Tahoma",8


To have no extended styles, just simply leave it at zero.
Posted on 2003-04-22 15:41:18 by comrade
Thanks! :alright:
Posted on 2003-04-23 00:54:43 by Tommy
You have probably put there these square brackets by mistake - they are not needed. I'm attaching the new version of RESOURCE.INC file with changes to "dialog" and "dialogitem" macros applied - it'll be included with the next FASM release.
Posted on 2003-04-25 16:59:17 by Tomasz Grysztar
I am not much of expert in FASM macro programming, but thanks much!
Posted on 2003-04-25 21:16:11 by comrade
I modified dialog, dialogitem macros and added new macro called enddlg. These modifications allow developer not to specify number of items in dialog macro, and count manually:
macro dialog label,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,0,title,0
if fontname eq
du 8,'MS Sans Serif',0
else
du fontsize+0,fontname,0
end if
align 4
dialog_items = 0
dialog_items_size equ items = dialog_items
dialog_size equ size = $ - data
}

macro dialogitem class,title,id,x,y,cx,cy,style,exstyle
{ dd style or WS_CHILD,exstyle +0
dw x,y,cx,cy,id
if class eq 'BUTTON'
dw 0FFFFh,80h
else if class eq 'EDIT'
dw 0FFFFh,81h
else if class eq 'STATIC'
dw 0FFFFh,82h
else if class eq 'LISTBOX'
dw 0FFFFh,83h
else if class eq 'SCROLLBAR'
dw 0FFFFh,84h
else if class eq 'COMBOBOX'
dw 0FFFFh,85h
else
du class,0
end if
if title eqtype 0
dw 0FFFFh,title
else
du title,0
end if
dw 0
align 4
dialog_items = dialog_items + 1
}

macro enddlg {
dialog_items_size
dialog_size
}


So now you can skip itemcount parameter and will have to close dialog with enddlg macro:
dialog main,"Knob",0,0,200,120,DS_CENTER+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX,0,0,"Tahoma",8

dialogitem "BUTTON","&About...",ID_MAIN_ABOUT,38,102,48,14,BS_DEFPUSHBUTTON+WS_TABSTOP+WS_VISIBLE
dialogitem "BUTTON","&Close",ID_MAIN_CLOSE,114,102,48,14,BS_PUSHBUTTON+WS_TABSTOP+WS_VISIBLE
enddlg
Posted on 2003-05-11 08:15:36 by comrade
Nice Comrade !
It is nice how people are writting thing to solve the small FASM annoying things (like counting the resources item !!!) : :alright:
I would like to have more time to involve myself in such developments...
Posted on 2003-05-12 06:28:02 by JCP