Code: Select all
Sub Dialog( Byval cdit As WORD, _
Byval x As Short, _
Byval y As Short, _
Byval cx As Short, _
Byval cy As Short, _
Byref title As String, _
Byref lpdt As LPDLGTEMPLATE, _
Byval style As DWORD, _
Byval pointSize As Short = 10, _ ' default size. set to 0 for default system
Byref typeFace As String = "MS Sans Serif" ) ' default font. set to "" for default system
g_dialog_width = cx
lpdt = GlobalAlloc( GMEM_FIXED Or GMEM_ZEROINIT, 1024 * 10 )
'' Memory allocated by GlobalAlloc is guaranteed to be
'' aligned on an 8-byte boundary. Initialize the essential
'' members of the structure.
''
lpdt->cdit = cdit
lpdt->x = x
lpdt->y = y
lpdt->cx = cx
lpdt->cy = cy
'' Set g_lpw to the menu array that follows the structure.
''
g_lpw = cast(LPWORD,lpdt + 1)
'' Skip the first element of the menu array, leaving it
'' set to zero (no menu).
''
g_lpw += 1
'' Skip the first element of the class array, leaving it
'' set to zero (no class), so the system will use the
'' predefined dialog box class.
''
g_lpw += 1
'' Initialize the title array and set g_lpw to next WORD
'' following the title array.
''
GenUstring( title )
'' If the DS_SETFONT style was specified, set the font
'' point size, initialize the typeface array, and set
'' g_lpw to next WORD following the typeface array.
''
'' Now DS_SETFONT style is automatic.
''
If pointSize And typeFace<>"" Then
style Or= DS_SETFONT
*g_lpw = pointSize
g_lpw += 1
GenUstring( typeFace )
Else
style And= Not DS_SETFONT
End If
lpdt->style = style
End Sub
Code: Select all
...
Dim As LPDLGTEMPLATE lpdt
Dialog( 8, 0, 0, 150, 100, "Group Demo", lpdt, _
WS_OVERLAPPED Or WS_SYSMENU Or DS_CENTER )
...
Code: Select all
...
Dim As LPDLGTEMPLATE lpdt
Dialog( 8, 0, 0, 150, 100, "Group Demo", lpdt, _
WS_OVERLAPPED Or WS_SYSMENU Or DS_CENTER, 0 )
...
Code: Select all
...
Dim As LPDLGTEMPLATE lpdt
Dialog( 8, 0, 0, 150, 100, "Group Demo", lpdt, _
WS_OVERLAPPED Or WS_SYSMENU Or DS_CENTER, 30, "Courier" )
...