Hutch has written great macros in dialogs.inc, see demos in \masm32\examples\dialogs_later.
The new MasmBasic macros are inspired by his work but even more "basic", in the sense: the Right Thing
TM for beginners. Here is an example showing a prompt for entering data, on exit available in the Dlg$() array for further processing:
include \masm32\MasmBasic\
MasmBasic.inc ; download Init DlgDefine "Please enter your data, tab for next line:", 0, 0, 150, -4
DlgControl dcEdit, "First name", WS_BORDER or WS_TABSTOP,
1,
-2 ;
first control gets the focus DlgControl dcEdit, "Family name", WS_BORDER or WS_TABSTOP,
1,
-4 ;
x, y only, the macro will assign width, height and ID
DlgControl dcStatic, "Type your first name:", SS_LEFT,
1,
-1, 70.0 ; 70 means 70% - the buttons need space
DlgControl dcButton, "OK", BS_DEFPUSHBUTTON or WS_TABSTOP,
71.0,
-1,
12.0, ,
IDOK ; x=71%, y, width=14%, height
, ID
DlgControl dcButton, "Quit", BS_PUSHBUTTON or WS_TABSTOP,
84.0,
-1,
16.0, ,
IDCANCEL
DlgControl dcStatic, wCat$("Type your family name: (it's "+
wTime$+" now)"), SS_LEFT,
1,
-3
;
DlgHandler MyHandler ;
optional - PM me for details DlgShow .if eax==IDOK
wMsgBox 0,
wCat$(Dlg$(0)+wCrLf$+Dlg$(1)), "Please confirm::", MB_OKCANCEL
.endif
Exitend start
Another example showing how easy it is to code a Unicode dialog:
include \masm32\MasmBasic\
MasmBasic.inc ;
download Init DlgDefine "Simpler than that is difficult:", 0, 0,
87,
82,
DS_CENTER,
14 ; text, x, y, width, height [, style] [, font size] [, font face] DlgControl dcStatic, "... but why make it simple when you could code complicate stuff, too?", SS_LEFT,
2,
2, , 30
DlgControl dcEdit, wCat$(wRes$(3)+wCrLf$+wRes$(403)+wCrLf$+wRes$(803)+wCrLf$+wRes$(1203)) , ES_MULTILINE or WS_BORDER,
3,
33, , 38
DlgShow Exitend start
I attach the sources and executables, plus a simple RTF viever coded in 54 lines. You need the
MasmBasic version of today 17 September to assemble the examples.
Enjoy, jj