Dialog with style

by Pierre Bellisle

#COMPILE EXE '#Win#
#REGISTER NONE
#DIM ALL
#INCLUDE "Win32Api.Inc"
#INCLUDE "CommCtrl.inc"
#RESOURCE "Resource.pbr" 'Rem the line or create a resource to use common control 6 for better looking.

#IF %PB_REVISION < &H1000
DECLARE FUNCTION SetWindowTheme LIB "UxTheme.dll" ALIAS "SetWindowTheme" _
(BYVAL hwnd AS DWORD, pszSubAppName AS ASCIIZ, pszSubIdList AS ASCIIZ) AS LONG
#ELSE
DECLARE FUNCTION SetWindowTheme LIB "UxTheme.dll" ALIAS "SetWindowTheme" _
(BYVAL hwnd AS DWORD, pszSubAppName AS WSTRINGZ, pszSubIdList AS WSTRINGZ) AS LONG
#ENDIF

GLOBAL hDlg            AS DWORD
GLOBAL RightClick      AS LONG
GLOBAL PresetStyle()   AS DWORD
GLOBAL PresetExStyle() AS DWORD

%ButtonQuit             = 201
%ButtonUnderscore       = 202
%ButtonPopupWindow      = 203
%ButtonOverlappedWindow = 204
%ButtonOverlappedWin    = 205
%ButtonReset            = 206
%ButtonClipboard        = 207
%ButtonPreset01         = 221
%ButtonPreset02         = 222
%ButtonPreset03         = 223
%ButtonPreset04         = 224
%ButtonPreset05         = 225
%ButtonPreset06         = 226
%ButtonStyleOr          = 231
%ButtonStyleAnd         = 232
%ButtonExStyleOr        = 233
%ButtonExStyleAnd       = 234

%RadioChild           = 401
%RadioOverlapped      = 402
%RadioPopup           = 403

%RadioLeft            = 411
%RadioRight           = 412
%RadioLtrReading      = 421
%RadioRtlReading      = 422
%RadioLeftScrollbar   = 431
%RadioRightScrollbar  = 432

%CheckBorder          = 501
%CheckDlgframe        = 502
%CheckThickframe      = 503
%CheckCaption         = 504
%CheckSysmenu         = 505
%CheckMinimizebox     = 506
%CheckMaximizebox     = 507
%CheckMaximize        = 508
%CheckMinimize        = 509
%CheckClipsiblings    = 510
%CheckClipchildren    = 511
%CheckHscroll         = 512
%CheckVscroll         = 513
%CheckVisible         = 514
%CheckDisabled        = 515
%CheckAbsalign        = 520
%CheckSysmodal        = 521
%CheckModalframe      = 522
%CheckSetforeground   = 523
%CheckControl         = 524
%CheckCenter          = 525
%CheckCentermouse     = 526
%CheckContexthelp     = 527
%Check3dlook          = 528
%CheckNofailcreate    = 529
%CheckSetfont         = 530

%CheckClientedge      = 601
%CheckStaticedge      = 602
%CheckWindowedge      = 603
%CheckDlgModalFrame   = 604
%CheckTransparent     = 605
%CheckAcceptfiles     = 606
%CheckControlparent   = 607
%CheckExContexthelp   = 608
%CheckNoparentNotify  = 609
%CheckTopmost         = 610
%CheckAppwindow       = 611
%CheckMdiChild        = 612
%CheckToolWindow      = 613
%CheckLayoutRtl       = 614

%CheckTheme           = 621
%CheckDefaultExStyle  = 622

%TextboxStyle         = 701
%TextboxInfo          = 702
%TextboxStyleHex      = 703
%TextboxExStyleHex    = 704

%LabelStyleHex        = 801
%LabelExStyleHex      = 802

%WM_InitDialogDone    = %WM_APP + 0
%PresetCount          = 6

%WS_OVERLAPPEDWIN       = %WS_OVERLAPPED OR %WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME 'DDT only
%WS_OVERLAPPEDWINDOW    = %WS_OVERLAPPED OR %WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX
%WS_POPUPWINDOW         = %WS_POPUP OR %WS_BORDER OR %WS_SYSMENU
%WS_EX_OVERLAPPEDWINDOW = %WS_EX_WINDOWEDGE OR %WS_EX_CLIENTEDGE
%WS_EX_PALETTEWINDOW    = %WS_EX_WINDOWEDGE OR %WS_EX_TOOLWINDOW OR %WS_EX_TOPMOST


$WS_BORDER            = "WS_BORDER &h00800000 Creates a window that has a thin-line border."
$WS_CAPTION           = "WS_CAPTION &h00C00000 Creates a window that has a title bar including the WS_BORDER style."
$WS_CHILD             = "WS_CHILD = WS_CHILDWINDOW &h40000000 Creates a child window. A window with this style cannot have a menu bar. This style cannot be used with the WS_POPUP style."
'$WS_CHILDWINDOW      = "WS_CHILDWINDOW 40000000 Same as the WS_CHILD style."
$WS_CLIPCHILDREN      = "WS_CLIPCHILDREN &H02000000 Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window."
$WS_CLIPSIBLINGS1     = "WS_CLIPSIBLINGS &H04000000 Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message,"
$WS_CLIPSIBLINGS2     = " the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated."
$WS_CLIPSIBLINGS3     = " If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible,"
$WS_CLIPSIBLINGS4     = " when drawing within the client area of a child window, to draw within the client area of a neighboring child window."
$WS_DISABLED          = "WS_DISABLED &H08000000 Creates a window that is initially disabled. A disabled window cannot receive input from the user. To change this after a window has been created, use EnableWindow."
$WS_DLGFRAME          = "WS_DLGFRAME &H00400000 Creates a window that has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar."
$WS_GROUP1            = "WS_GROUP &H00020000 Specifies the first control of a group of controls. The group consists of this first control and all controls defined after it,"
$WS_GROUP2            = " up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that"
$WS_GROUP3            = " the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to"
$WS_GROUP4            = " the next control in the group by using the direction keys."
$WS_GROUP5            = " You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use SetWindowLong."
$WS_HSCROLL           = "WS_HSCROLL &H00100000 Creates a window that has a horizontal scroll bar."
'$WS_ICONIC            = "WS_ICONIC = %WS_MINIMIZE &H20000000 Creates a window that is initially minimized. Same as the WS_MINIMIZE style."
$WS_MAXIMIZE          = "WS_MAXIMIZE &H01000000 Creates a window that is initially maximized."
$WS_MAXIMIZEBOX       = "WS_MAXIMIZEBOX &H00010000 Creates a window that has a maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified."
$WS_MINIMIZE          = "WS_MINIMIZE = WS_ICONIC &H20000000 Creates a window that is initially minimized. Same as the WS_ICONIC style."
$WS_MINIMIZEBOX       = "WS_MINIMIZEBOX &H00020000 Creates a window that has a minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified."
$WS_OVERLAPPED1       = "WS_OVERLAPPED &H0 Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style."
$WS_OVERLAPPED2       = $CRLF & "WS_OVERLAPPED = WS_TILED"
$WS_OVERLAPPEDWIN     = "WS_OVERLAPPEDWIN = WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME (PowerBASIC only)"
$WS_OVERLAPPEDWINDOW1 = "WS_OVERLAPPEDWINDOW = WS_TILEDWINDOW = WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME OR %WS_MINIMIZEBOX OR WS_MAXIMIZEBOX Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, "
$WS_OVERLAPPEDWINDOW2 = "WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style."
$WS_POPUP             = "WS_POPUP &H80000000 Creates a pop-up window. This style cannot be used with the WS_CHILD style."
$WS_POPUPWINDOW       = "WS_POPUPWINDOW = %WS_POPUP OR %WS_BORDER OR %WS_SYSMENU Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible."
'$WS_SIZEBOX          = "WS_SIZEBOX = WS_THICKFRAME &H00040000 Creates a window that has a sizing border. Same as the WS_THICKFRAME style."
$WS_SYSMENU           = "WS_SYSMENU &H00080000 Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified."
$WS_TABSTOP1          = "WS_TABSTOP &H00010000 Specifies a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style."
$WS_TABSTOP2          = " You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use SetWindowLong."
$WS_THICKFRAME        = "WS_THICKFRAME = WS_SIZEBOX &H00040000 Creates a window that has a sizing border."
$WS_TILED             = "WS_TILED = WS_OVERLAPPED &H0 Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style."
$WS_TILEDWINDOW1      = "WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW = %WS_OVERLAPPED OR %WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, "
$WS_TILEDWINDOW2      = "WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style."
$WS_VISIBLE           = "WS_VISIBLE &H10000000 Creates a window that is initially visible. This style can be turned on and off by using ShowWindow or SetWindowPos."
$WS_VSCROLL           = "WS_VSCROLL &H00200000 Creates a window that has a vertical scroll bar."

$WS_EX_ACCEPTFILES    = "WS_EX_ACCEPTFILES &H00000010 Specifies that a window created with this style accepts drag-drop files."
$WS_EX_APPWINDOW      = "WS_EX_APPWINDOW &H00040000 Forces a top-level window onto the taskbar when the window is visible."
$WS_EX_CLIENTEDGE     = "WS_EX_CLIENTEDGE &H00000200 Specifies that a window has a border with a sunken edge."
$WS_EX_COMPOSITED1    = "WS_EX_COMPOSITED &H02000000 Whistler: Paints all descendants of a window in bottom-to-top painting order using double-buffering. For more information, "
$WS_EX_COMPOSITED2    = "see Remarks. This cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC."
$WS_EX_CONTEXTHELP1   = "WS_EX_CONTEXTHELP &H00000400 Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, "
$WS_EX_CONTEXTHELP2   = "the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. "
$WS_EX_CONTEXTHELP3   = "The Help application displays a pop-up window that typically contains help for the child window. "
$WS_EX_CONTEXTHELP4   = "$WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles."
$WS_EX_CONTROLPARENT1 = "WS_EX_CONTROLPARENT &H00010000 The window itself contains child windows that should take part in dialog box navigation. If this style is specified, the dialog manager recurses into children of "
$WS_EX_CONTROLPARENT2 = "this window when performing navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic."
$WS_EX_DLGMODALFRAME  = "WS_EX_DLGMODALFRAME &H00000001 Creates a window that has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the dwStyle parameter."
$WS_EX_LAYERED        = "WS_EX_LAYERED &H00080000 Windows 2000 or later: Creates a layered window. Note that this cannot be used for child windows. Also, this cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC."
$WS_EX_LAYOUTRTL      = "WS_EX_LAYOUTRTL &H00400000 Windows 2000 and the Arabic and Hebrew versions of Windows 98 and Windows Me: Creates a window whose horizontal origin is on the right edge. Increasing horizontal values advance to the left."
$WS_EX_LEFT           = "WS_EX_LEFT &H00000000 Creates a window that has generic left-aligned properties. This is the default."
$WS_EX_LEFTSCROLLBAR1 = "WS_EX_LEFTSCROLLBAR &H00004000 If the shell language is Hebrew, Arabic, or another language that supports "
$WS_EX_LEFTSCROLLBAR2 = "reading order alignment, the vertical scroll bar (if present) is to the left of the client area. For other languages, the style is ignored."
$WS_EX_LTRREADING     = "WS_EX_LTRREADING &H00000000 The window text is displayed using left-to-right reading-order properties. This is the default."
$WS_EX_MDICHILD       = "WS_EX_MDICHILD &H00000040 Creates an MDI child window."
$WS_EX_NOACTIVATE1    = "WS_EX_NOACTIVATE &H08000000 Windows 2000 or later: A top-level window created with this style does not become the foreground window when the user clicks it. "
$WS_EX_NOACTIVATE2    = "The system does not bring this window to the foreground when the user minimizes or closes the foreground window. "
$WS_EX_NOACTIVATE3    = "To activate the window, use the SetActiveWindow or SetForegroundWindow function. "
$WS_EX_NOACTIVATE4    = "The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style."
$WS_EX_NOINHERITLAYOUT  = "WS_EX_NOINHERITLAYOUT &H00100000 Windows 2000 or later: A window created with this style does not pass its window layout to its child windows."
$WS_EX_NOPARENTNOTIFY   = "WS_EX_NOPARENTNOTIFY &H00000004 Specifies that a child window created with this style does not send the WM_PARENTNOTIFY message to its parent window when it is created or destroyed."
$WS_EX_OVERLAPPEDWINDOW = "WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE OR WS_EX_CLIENTEDGE Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles."
$WS_EX_PALETTEWINDOW  = "WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE OR WS_EX_TOOLWINDOW OR WS_EX_TOPMOST Combines the WS_EX_WINDOWEDGE, WS_EX_TOOLWINDOW, and WS_EX_TOPMOST styles."
$WS_EX_RIGHT1         = "WS_EX_RIGHT &H00001000 The window has generic ""right-aligned"" properties. This depends on the window class. "
$WS_EX_RIGHT2         = "This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading-order alignment; otherwise, the style is ignored."
$WS_EX_RIGHTSCROLLBAR = "WS_EX_RIGHTSCROLLBAR &H00000000 Vertical scroll bar (if present) is to the right of the client area. This is the default."
$WS_EX_RTLREADING1    = "WS_EX_RTLREADING &H00002000 If the shell language is Hebrew, Arabic, or another language that supports reading-order alignment, the window text "
$WS_EX_RTLREADING2    = "is displayed using right-to-left reading-order properties. For other languages, the style is ignored."
$WS_EX_STATICEDGE     = "WS_EX_STATICEDGE &H00020000 Creates a window with a three-dimensional border style intended to be used for items that do not accept user input."
$WS_EX_TOOLWINDOW1    = "WS_EX_TOOLWINDOW &H00000080 Creates a tool window; that is, a window intended to be used as a floating toolbar. A tool window has a title"
$WS_EX_TOOLWINDOW2    = " bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. "
$WS_EX_TOOLWINDOW3    = "A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. "
$WS_EX_TOOLWINDOW4    = "However, you can display the system menu by right-clicking or by typing ALT+SPACE."
$WS_EX_TOPMOST1       = "WS_EX_TOPMOST &H00000008 Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even "
$WS_EX_TOPMOST2       = "when the window is deactivated. To add or remove this style, use the SetWindowPos function."
$WS_EX_TRANSPARENT1   = "WS_EX_TRANSPARENT &H00000020 Specifies that a window created with this style should not be painted until siblings beneath the window (that were created by the same thread) have been painted. "
$WS_EX_TRANSPARENT2   = "The window appears transparent because the bits of underlying sibling windows have already been painted. "
$WS_EX_TRANSPARENT3   = "To achieve transparency without these restrictions, use the SetWindowRgn function."
$WS_EX_WINDOWEDGE     = "WS_EX_WINDOWEDGE &H00000100 Specifies that a window has a border with a raised edge."
$WS_EX_LAYOUTRTL1    = "WS_EX_LAYOUTRTL 0x00400000L If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the horizontal origin of the window is on the right edge. "
$WS_EX_LAYOUTRTL2    = "Increasing horizontal values advance to the left."

$DS_3DLOOK1           = "DS_3DLOOK &H00000004& Gives the dialog box a nonbold font, and draws three-dimensional borders around control windows in the dialog box. "
$DS_3DLOOK2           = "The DS_3DLOOK style is required only by applications compiled for Windows NT 3.51. The system automatically applies the three-dimensional "
$DS_3DLOOK3           = "look to dialog boxes created by applications compiled for Windows 95/98 and later versions of Windows NT."
$DS_ABSALIGN          = "DS_ABSALIGN &H00000001& Indicates that the coordinates of the dialog box are screen coordinates. If this style is not specified, the coordinates are client coordinates."
$DS_CENTER1           = "DS_CENTER &H00000800& Centers the dialog box in the working area of the monitor that contains the owner window. If no owner window is specified, the dialog box is centered in the working area of "
$DS_CENTER2           = "a monitor determined by the system. The working area is the area not obscured by the taskbar or any appbars."
$DS_CENTERMOUSE       = "DS_CENTERMOUSE &H00001000& Centers the dialog box on the mouse cursor."
$DS_CONTEXTHELP1      = "DS_CONTEXTHELP &H00002000& Includes a question mark in the title bar of the dialog box. When the user clicks the question mark, "
$DS_CONTEXTHELP2      = "the cursor changes to a question mark with a pointer. If the user then clicks a control in the dialog box, "
$DS_CONTEXTHELP3      = "the control receives a WM_HELP message. The control should pass the message to the dialog box procedure, which should call the WinHelp function using the HELP_WM_HELP command. "
$DS_CONTEXTHELP4      = "The help application displays a pop-up window that typically contains help for the control. "
$DS_CONTEXTHELP5      = "Note that DS_CONTEXTHELP is only a placeholder. When the dialog box is created, the system checks for DS_CONTEXTHELP and, if it is there, adds WS_EX_CONTEXTHELP to the extended style of the dialog box. "
$DS_CONTEXTHELP6      = "WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles."
$DS_CONTROL1          = "DS_CONTROL &H00000400& Creates a dialog box that works well as a child window of another dialog box, much like a page in a property sheet. "
$DS_CONTROL2          = "This style allows the user to tab among the control windows of a child dialog box, use its accelerator keys, and so on."
$DS_FIXEDSYS          = "DS_FIXEDSYS &H00000008& Causes the dialog box to use the SYSTEM_FIXED_FONT instead of the default SYSTEM_FONT. This is a monospace font compatible with the System font in 16-bit versions of Windows earlier than 3.0."
$DS_LOCALEDIT1        = "DS_LOCALEDIT &H00000020& Applies to 16-bit applications only. This style directs edit controls in the dialog box to allocate memory from the application's data segment. "
$DS_LOCALEDIT2        = "Otherwise, edit controls allocate storage from a global memory object."
$DS_MODALFRAME        = "DS_MODALFRAME &H00000080& Creates a dialog box with a modal dialog-box frame that can be combined with a title bar and window menu by specifying the WS_CAPTION and WS_SYSMENU styles."
$DS_NOFAILCREATE      = "DS_NOFAILCREATE &H00000010& Windows 95/98/Me: Creates the dialog box even if errors occur — for example, if a child window cannot be created or if the system cannot create a special data segment for an edit control."
$DS_NOIDLEMSG         = "DS_NOIDLEMSG &H00000100& Suppresses WM_ENTERIDLE messages that the system would otherwise send to the owner of the dialog box while the dialog box is displayed."
$DS_SETFONT1          = "DS_SETFONT &H00000040& Indicates that the header of the dialog box template (either standard or extended) contains additional data specifying the font to use for text in the client area and controls of the dialog box. "
$DS_SETFONT2          = "If possible, the system selects a font according to the specified font data. The system passes a handle to the font to the dialog box and to each control by sending them the WM_SETFONT message. "
$DS_SETFONT3          = "For descriptions of the format of this font data, see DLGTEMPLATE and DLGTEMPLATEEX. "
$DS_SETFONT4          = "If neither DS_SETFONT nor DS_SHELLFONT is specified, the dialog box template does not include the font data."
$DS_SETFOREGROUND1    = "DS_SETFOREGROUND &H00000200& Causes the system to use the SetForegroundWindow function to bring the dialog box to the foreground. This style is useful for modal dialog boxes that require "
$DS_SETFOREGROUND2    = "immediate attention from the user regardless of whether the owner window is the foreground window. "
$DS_SETFOREGROUND3    = "Windows 98/Me, Windows 2000 or later: The system restricts which processes can set the foreground window. For more information, see Foreground and Background Windows."
$DS_SHELLFONT1        = "DS_SHELLFONT DS_SETFONT OR DS_FIXEDSYS Indicates that the dialog box should use the system font. The typeface member of the extended dialog box template must be set to MS Shell Dlg. Otherwise, this style has no effect. "
$DS_SHELLFONT2        = "It is also recommended that you use the DIALOGEX resource, rather than the DIALOG resource. For more information, see Dialog Box Fonts. "
$DS_SHELLFONT3        = "The system selects a font using the font data specified in the pointsize, weight, and italic members. The system passes a handle to the font "
$DS_SHELLFONT4        = "to the dialog box and to each control by sending them the WM_SETFONT message. For descriptions of the format of this font data, see DLGTEMPLATEEX. "
$DS_SHELLFONT5        = "If neither DS_SHELLFONT nor DS_SETFONT is specified, the extended dialog box template does not include the font data."
$DS_SYSMODAL1         = "DS_SYSMODAL &H00000002& This style is obsolete and is included for compatibility with 16-bit versions of Windows. If you specify this style, the system creates the dialog box with the WS_EX_TOPMOST style. "
$DS_SYSMODAL2         = "This style does not prevent the user from accessing other windows on the desktop. "
$DS_SYSMODAL3         = "Do not combine this style with the DS_CONTROL style."
$DefaultExStyle       = "Show or hide extended style that have a value of zero."
$Theme                = "Show the #32770 dialog themed or not."
$Info                 = "Dialog with style..." & $CRLF & "Interactively change this dialog style and see the effect." & $CRLF  & $CRLF & _
                        "Use right-click on any item to view description without action." & $CRLF & _
                        "Double-click on style and exstyle label to set edit control." & $CRLF & $CRLF & "Copy the result in your own code."
$Preset               = "To record, set dialog as desired and Control-Click on button, " & $CRLF & "then click to recall preset"
'______________________________________________________________________________

FUNCTION ExeName(Action AS LONG) AS STRING 'Return the ExeName of this APP or ExeName of calling app if DLL
 LOCAL zFileName   AS ASCIIZ * %Max_Path
 LOCAL PathFileLen AS LONG
 LOCAL FileExtLen  AS LONG
 LOCAL DotPos      AS LONG
 LOCAL SlashPos    AS LONG

 PathFileLen = GetModuleFileName(0, zFileName, %Max_Path)
 SlashPos    = INSTR(-1, zFileName, "\")
 DotPos      = INSTR(-1, zFileName, ".")
 IF DotPos < SlashPos THEN DotPos = 0
 FileExtLen = PathFileLen - SlashPos

 SELECT CASE Action

   CASE 0 '"C:\Subdir\File.exe" - Path, FileName, Extention
     FUNCTION = LEFT$(zFileName, PathFileLen)

   CASE 1 'C:\Subdir\File - Path and filename (No Dot, no Extention)
     IF DotPos THEN
       FUNCTION = LEFT$(zFileName, DotPos - 1)
     ELSE
       FUNCTION = LEFT$(zFileName, PathFileLen)
     END IF

   CASE 2 'C:\Subdir\ - Path with last backslash (No FileName no Extention))
     FUNCTION = LEFT$(zFileName, SlashPos)

   CASE 3 'File.exe - Filename, Dot, Extention (No Path)
     FUNCTION = MID$(zFileName, SlashPos + 1, FileExtLen)

   CASE 4 'File - Filename only (No Path, no Dot, no Extention)
     IF DotPos THEN
       FUNCTION = MID$(zFileName, SlashPos + 1, FileExtLen - (PathFileLen - DotPos) - 1)
     ELSE
       FUNCTION = MID$(zFileName, SlashPos + 1, FileExtLen)
     END IF

   'CASE 5 '.Ext - .Extention only (No Path, no File)
   '  IF DotPos THEN
   '    FUNCTION = MID$(zFileName, DotPos, FileExtLen)
   '  END IF

 END SELECT

END FUNCTION
'______________________________________________________________________________

FUNCTION FileExist(sFileName AS STRING) AS LONG
 LOCAL Attribute AS DWORD

 Attribute = GetFileAttributes(BYVAL STRPTR(sFileName))
 IF Attribute <> %INVALID_HANDLE_VALUE THEN
   IF (Attribute AND %FILE_ATTRIBUTE_DIRECTORY) THEN
     FUNCTION = %FILE_ATTRIBUTE_DIRECTORY
   ELSE
     FUNCTION = %TRUE
   END IF
 END IF

END FUNCTION
'______________________________________________________________________________

FUNCTION FileIniNameGet() AS STRING
 LOCAL zPathExe           AS ASCIIZ * %MAX_PATH
 LOCAL zPathWindows       AS ASCIIZ * %MAX_PATH
 LOCAL zPathDesktop       AS ASCIIZ * %MAX_PATH
 LOCAL zPathProgramFiles  AS ASCIIZ * %MAX_PATH
 LOCAL zPathCommonAppData AS ASCIIZ * %MAX_PATH
 LOCAL UseCommonAppData   AS LONG
 LOCAL hFile              AS LONG
 LOCAL ErrorNum           AS LONG

 'UAC protection for the Windows since Vista use virtualisation to redirect
 'the write of ini file. One should avoid to write to the redirected VirtualStore
 'and use %CSIDL_COMMON_APPDATA or %CSIDL_APPDATA for user specific.

 'Example of a virtualized file when
 'trying to write to "C:\Program Files (x86)\pbwinspy\pbexe.ini" will write in fact to
 '"C:\Users\UserName\AppData\Local\VirtualStore\Program Files (x86)\pbwinspy\pbexe.ini"

 'No ini should be written to %CSIDL_WINDOWS, %CSIDL_PROGRAM_FILES or %CSIDL_PROGRAM_FILESX86.
 'If the ini is not under any UAC protected folder the no virtualisation will occur.

 '%CSIDL_WINDOWS          C:\Windows
 '%CSIDL_DESKTOP          C:\Users\User\Desktop
 '%CSIDL_COMMON_APPDATA   C:\ProgramData
 '%CSIDL_PROGRAM_FILES    C:\Program Files (x86) [OS64, App32]
 '%CSIDL_PROGRAM_FILES    C:\Program Files       [OS-bit = App-bit]
 '%CSIDL_PROGRAM_FILESX86 C:\Program Files (x86)

 zPathExe = ExeName(2)

 'Optional: Keep desktop clean
 SHGetFolderPath(BYVAL 0, %CSIDL_DESKTOP, BYVAL 0, BYVAL 0, zPathDesktop)
 zPathDesktop = zPathDesktop & "\"
 IF LEFT$(zPathExe, LEN(zPathDesktop)) = zPathDesktop THEN 'In "\Desktop\" folder
   UseCommonAppData = %TRUE
 END IF

 SHGetFolderPath(BYVAL 0, %CSIDL_WINDOWS, BYVAL 0, BYVAL 0, zPathWindows)
 zPathWindows = zPathWindows & "\"
 IF LEFT$(zPathExe, LEN(zPathWindows)) = zPathWindows THEN 'In "\Windows\" folder
   UseCommonAppData = %TRUE
 END IF

 SHGetFolderPath(BYVAL 0, %CSIDL_PROGRAM_FILES, BYVAL 0, BYVAL 0, zPathProgramFiles)
 zPathProgramFiles = zPathProgramFiles & "\"
 IF LEFT$(zPathExe, LEN(zPathProgramFiles)) = zPathProgramFiles THEN 'In "\Program Files[ (x86)]\" folder
   UseCommonAppData = %TRUE
 END IF
 IF RIGHT$(zPathProgramFiles, 7) = " (x86)\" THEN '32 bit app under 64 bit OS
   zPathProgramFiles = LEFT$(zPathProgramFiles, LEN(zPathProgramFiles) - 7) & "\"
   IF LEFT$(zPathExe, LEN(zPathProgramFiles)) = zPathProgramFiles THEN 'In "\Program Files\" folder
     UseCommonAppData = %TRUE
   END IF
 END IF

 IF UseCommonAppData = %FALSE THEN 'Is folder writable
   hFile = FREEFILE
   ERRCLEAR
   OPEN zPathExe & "DeleteMe.txt" FOR OUTPUT AS hFile
   ErrorNum = ERR
   IF ErrorNum THEN 'No write permission
      UseCommonAppData = %TRUE '"No write permission !!!!"
   ELSE
     CLOSE hFile
     KILL zPathExe & "DeleteMe.txt"
   END IF
 END IF

 SHGetFolderPath(BYVAL 0, %CSIDL_COMMON_APPDATA, BYVAL 0, BYVAL 0, zPathCommonAppData)
 zPathCommonAppData = zPathCommonAppData & "\"

 IF UseCommonAppData THEN
   zPathCommonAppData = zPathCommonAppData & ExeName(4) & "\"
   IF FileExist(BYCOPY zPathCommonAppData) <> %FILE_ATTRIBUTE_DIRECTORY THEN
     CreateDirectory(zPathCommonAppData, BYVAL %NULL)
   END IF
   FUNCTION = zPathCommonAppData & ExeName(4) & ".ini"
 ELSE
   FUNCTION = ExeName(1) & ".ini"
 END IF

END FUNCTION
'______________________________________________________________________________

FUNCTION FileIniSave() AS LONG
 LOCAL WinPla       AS WINDOWPLACEMENT
 LOCAL sFileName    AS STRING
 LOCAL hFile        AS LONG
 LOCAL Looper       AS LONG

 WinPla.Length = SIZEOF(WinPla)
 GetWindowPlacement(hDlg, WinPla)
 sFileName = FileIniNameGet()
 hFile = FREEFILE
 ERRCLEAR
 OPEN sFileName FOR OUTPUT AS hFile
 IF ERR THEN
 ELSE
   PRINT # hFile, "[Dialog]"
   PRINT # hFile, "Left         =" & STR$(WinPla.rcNormalPosition.nLeft)
   PRINT # hFile, "Right        =" & STR$(WinPla.rcNormalPosition.nRight)
   PRINT # hFile, "Top          =" & STR$(WinPla.rcNormalPosition.nTop)
   PRINT # hFile, "Bottom       =" & STR$(WinPla.rcNormalPosition.nBottom)
   PRINT # hFile, "Maximized    =" & STR$(WinPla.showCmd = %SW_SHOWMAXIMIZED)
   PRINT # hFile, "Style        = 0x" & HEX$(GetWindowLong(hDlg, %GWL_STYLE), 8)
   PRINT # hFile, "ExStyle      = 0x" & HEX$(GetWindowLong(hDlg, %GWL_EXSTYLE), 8)
   PRINT # hFile, "Continuation = " & IIF$(IsDlgButtonChecked(hDlg, %ButtonUnderscore), "Yes", "No")
   PRINT # hFile, "DefaultStyle = " & IIF$(IsDlgButtonChecked(hDlg, %CheckDefaultExStyle), "Yes", "No")
   PRINT # hFile, "Theme        = " & IIF$(IsDlgButtonChecked(hDlg, %CheckTheme), "Yes", "No")
   FOR Looper = 1 TO %PresetCount
    PRINT # hFile, "Preset" & FORMAT$(Looper, "00") & _
                    "     = 0x" & HEX$(PresetStyle(Looper), 8) & _
                    ", 0x" & HEX$(PresetExStyle(Looper), 8)
   NEXT
   CLOSE hFile
 END IF

END FUNCTION
'______________________________________________________________________________

FUNCTION FileIniRead() AS LONG 'Restore previous coordinates.
 LOCAL WinPla       AS WINDOWPLACEMENT
 LOCAL rcDeskTop    AS RECT
 LOCAL sBuffer      AS STRING
 LOCAL sFileName    AS STRING
 LOCAL sDescription AS STRING
 LOCAL sData        AS STRING
 LOCAL sSection     AS STRING
 LOCAL hFile        AS LONG
 LOCAL CharVal      AS LONG
 LOCAL CharPos      AS LONG
 LOCAL Looper       AS LONG

 sFileName = FileIniNameGet()
 hFile = FREEFILE
 ERRCLEAR
 OPEN sFileName FOR INPUT AS hFile

 IF ERR = %ERR_NOERROR THEN
   DO UNTIL EOF(hFile)
     LINE INPUT #hFile, sBuffer
     sBuffer = TRIM$(sBuffer)
     CharVal = ASC(sBuffer)
     IF CharVal = 91 THEN 'Left bracket -> [Section]
       CharPos = INSTR(sBuffer, "]")
       IF CharPos THEN
         sSection = LCASE$(LEFT$(sBuffer, CharPos)) 'Brackets included
       END IF
     ELSEIF CharVal = 59 THEN ';Remed line
     ELSEIF CharVal = 39 THEN ''Remed line
     ELSE
       CharPos = INSTR(sBuffer, "=") 'sDescription = sData
       IF CharPos THEN
         sDescription = LCASE$(RTRIM$(LEFT$(sBuffer, CharPos - 1)))
         sData = LTRIM$(MID$(sBuffer, CharPos + 1))
         SELECT CASE sSection
         'Put sSection and sDescription in minus in this function, sData will be read as is.
           CASE "[dialog]"
             SELECT CASE sDescription
               CASE "left"         : WinPla.rcNormalPosition.nLeft   = VAL(sData)
               CASE "right"        : WinPla.rcNormalPosition.nRight  = VAL(sData)
               CASE "top"          : WinPla.rcNormalPosition.nTop    = VAL(sData)
               CASE "bottom"       : WinPla.rcNormalPosition.nBottom = VAL(sData)
               CASE "maximized"    : WinPla.showCmd = IIF(VAL(sData),%SW_SHOWMAXIMIZED, %SW_SHOWNORMAL)
               CASE "style"        : SetWindowLong(hDlg, %GWL_STYLE, VAL("&H" & MID$(sData, 3)))
               CASE "exstyle"      : SetWindowLong(hDlg, %GWL_EXSTYLE, VAL("&H" & MID$(sData, 3)))
               CASE "continuation" : IF LEN(sData) = 3 THEN CheckDlgButton(hDlg, %ButtonUnderscore, %BST_PUSHED) '"Yes" "No"
               CASE "defaultstyle" : IF LEN(sData) = 3 THEN CheckDlgButton(hDlg, %CheckDefaultExStyle, %BST_CHECKED) '"Yes" "No"
               CASE "theme"        : IF LEN(sData) = 3 THEN CheckDlgButton(hDlg, %CheckTheme, %BST_CHECKED) '"Yes" "No"
               CASE ELSE
                 IF LEFT$(sDescription, 6) = "preset" AND LEN(sDescription) = 8 THEN
                    PresetStyle(VAL(MID$(sDescription, 7, 2)))   = VAL("&H" & MID$(sData, INSTR(sData, "0x") + 2, 8))
                    PresetExStyle(VAL(MID$(sDescription, 7, 2))) = VAL("&H" & MID$(sData, INSTR(sData, ", 0x") + 4, 8))
                 END IF
             END SELECT
         END SELECT
       END IF
     END IF
   LOOP
   CLOSE hFile

   SystemParametersInfo(%SPI_GETWORKAREA, 0, BYVAL VARPTR(rcDesktop), 0) 'Desktop size minus taskbar, thanks to Börje

   'Screen resolution may have changed so make sure dialog is not horizontally oversized.
   IF WinPla.rcNormalPosition.nRight - WinPla.rcNormalPosition.nLeft > rcDesktop.nRight THEN
     WinPla.rcNormalPosition.nLeft  = 0
     WinPla.rcNormalPosition.nRight = rcDesktop.nRight
   END IF

   'Screen resolution may have changed so make sure dialog is not vertically oversized.
   IF WinPla.rcNormalPosition.nBottom - WinPla.rcNormalPosition.nTop > rcDesktop.nBottom THEN
     WinPla.rcNormalPosition.nTop    = 0
     WinPla.rcNormalPosition.nBottom = rcDesktop.nBottom
   END IF

   'Make sure left side of dialog is visible. (Optionnal)
   IF WinPla.rcNormalPosition.nLeft < 0 THEN
     WinPla.rcNormalPosition.nRight = WinPla.rcNormalPosition.nRight - WinPla.rcNormalPosition.nLeft
     WinPla.rcNormalPosition.nLeft = 0
   END IF

   'Make sure right side of dialog is visible. (Optionnal)
   IF WinPla.rcNormalPosition.nRight > rcDesktop.nRight THEN
     WinPla.rcNormalPosition.nLeft = WinPla.rcNormalPosition.nLeft - (WinPla.rcNormalPosition.nRight - rcDesktop.nRight)
     WinPla.rcNormalPosition.nRight = rcDesktop.nRight
   END IF

   'Make sure bottom side of dialog is visible. (Optionnal)
   IF WinPla.rcNormalPosition.nBottom > rcDesktop.nBottom THEN
     WinPla.rcNormalPosition.nTop = WinPla.rcNormalPosition.nTop - (WinPla.rcNormalPosition.nBottom - rcDesktop.nBottom)
     WinPla.rcNormalPosition.nBottom = rcDesktop.nBottom
   END IF

   'Make sure top side of dialog is visible. (Optionnal)
   IF WinPla.rcNormalPosition.nTop < 0 THEN
     WinPla.rcNormalPosition.nBottom = WinPla.rcNormalPosition.nBottom - WinPla.rcNormalPosition.nTop
     WinPla.rcNormalPosition.nTop = 0
   END IF

   WinPla.Length = SIZEOF(WinPla)
   SetWindowPlacement(hDlg, WinPla)

 ELSE
   'No ini found, set default here
   CheckDlgButton(hDlg, %CheckTheme, %BST_CHECKED)
 END IF

END FUNCTION
'______________________________________________________________________________

FUNCTION ClipBoardSet(BYVAL sBuffer AS STRING) AS LONG 'Updated 2011-02-17
 LOCAL pData       AS ASCIIZ POINTER
 LOCAL hClipboard  AS DWORD

 IF IsClipboardFormatAvailable(%CF_TEXT) THEN
   'If an application calls OpenClipboard with hwnd set to NULL,
   'EmptyClipboard sets the clipboard owner to NULL; this causes SetClipboardData to fail.
     IF OpenClipboard(hDlg) THEN
     EmptyClipboard()
     hClipboard = GlobalAlloc(%GMEM_MOVEABLE, LEN(sBuffer) + 1) '%GMEM_MOVEABLE OR %GMEM_ZEROINIT
     IF hClipboard THEN
       pData  = GlobalLock(hClipboard)
       @pData = sBuffer & $NUL
       GlobalUnlock(hClipboard)
       SetClipboardData(%CF_TEXT, hClipboard)
     END IF
     CloseClipboard
   END IF
 END IF

END FUNCTION
'______________________________________________________________________________

FUNCTION StyleSet(winStyle AS DWORD) AS LONG
 LOCAL CurrentWinStyle AS DWORD

 IF RightClick THEN RightClick = %FALSE : EXIT FUNCTION

 CurrentWinStyle = GetWindowLong(hDlg, %GWL_STYLE)

 SELECT CASE AS LONG winStyle
   CASE %WS_POPUP      '&H80000000
     CurrentWinStyle = %WS_POPUP OR (CurrentWinStyle AND NOT %WS_CHILD)
   CASE %WS_CHILD      '&H40000000
     CurrentWinStyle = %WS_CHILD OR CurrentWinStyle AND NOT %WS_POPUP
   CASE %WS_OVERLAPPED '0
     CurrentWinStyle = CurrentWinStyle AND NOT (%WS_POPUP OR %WS_CHILD)
   CASE ELSE
 END SELECT
 SetWindowLong(hDlg, %GWL_STYLE, CurrentWinStyle)

END FUNCTION
'______________________________________________________________________________

FUNCTION StyleFlip(winStyle AS DWORD, Action AS LONG) AS LONG
 LOCAL CurrentWinStyle AS DWORD

 IF RightClick THEN RightClick = %FALSE : EXIT FUNCTION

 CurrentWinStyle = GetWindowLong(hDlg, %GWL_STYLE)
 IF Action THEN
   SetWindowLong(hDlg, %GWL_STYLE, CurrentWinStyle OR winStyle)
 ELSE
   IF (CurrentWinStyle AND winStyle) THEN
     winStyle = CurrentWinStyle - winStyle
     SetWindowLong(hDlg, %GWL_STYLE, winStyle)
   END IF
 END IF

 SetWindowPos(hDlg, %HWND_TOP, 0, 0, 0, 0, %SWP_FRAMECHANGED OR %SWP_NOSIZE OR %SWP_NOMOVE)

END FUNCTION
'______________________________________________________________________________

FUNCTION ExStyleFlip(winExStyle AS DWORD, Action AS LONG) AS LONG
 LOCAL CurrentWinExStyle AS DWORD

 IF RightClick THEN RightClick = %FALSE : EXIT FUNCTION

 IF winExStyle = %WS_EX_TOPMOST THEN
   IF Action THEN
     SetWindowPos(hDlg, %HWND_TOPMOST	, 0, 0, 0, 0, %SWP_FRAMECHANGED OR %SWP_NOSIZE OR %SWP_NOMOVE)
   ELSE
     SetWindowPos(hDlg, %HWND_NOTOPMOST, 0, 0, 0, 0, %SWP_FRAMECHANGED OR %SWP_NOSIZE OR %SWP_NOMOVE)
   END IF
 ELSE
   CurrentWinExStyle = GetWindowLong(hDlg, %GWL_EXSTYLE)
   IF Action THEN
     SetWindowLong(hDlg, %GWL_EXSTYLE, CurrentWinExStyle OR winExStyle)
   ELSE
    IF (CurrentWinExStyle AND winExStyle) THEN
      winExStyle = CurrentWinExStyle - winExStyle
      SetWindowLong(hDlg, %GWL_EXSTYLE, winExStyle)
    END IF
   END IF

   SetWindowPos(hDlg, %HWND_TOP, 0, 0, 0, 0, %SWP_FRAMECHANGED OR %SWP_NOSIZE OR %SWP_NOMOVE)
 END IF

END FUNCTION
'______________________________________________________________________________

FUNCTION GetStyle() AS LONG
 LOCAL CurrentStyle   AS DWORD
 LOCAL CurrentExStyle AS DWORD
 LOCAL Txt            AS STRING
 LOCAL sOr            AS STRING

 CurrentStyle   = GetWindowLong(hDlg, %GWL_STYLE)
 CurrentExStyle = GetWindowLong(hDlg, %GWL_EXSTYLE)
 IF IsDlgButtonChecked(hDlg, %ButtonUnderscore) THEN
   sOr = " OR _"  & $CRLF
 ELSE
   sOr = " OR "  & $CRLF
 END IF

 IF (CurrentStyle AND %WS_POPUP)         THEN Txt = "%WS_POPUP"                     : CheckRadioButton(hDlg, %RadioChild, %RadioPopup, %RadioPopup)      '%WS_POPUP      = &H80000000
 IF (CurrentStyle AND %WS_CHILD)         THEN Txt = "%WS_CHILD"                     : CheckRadioButton(hDlg, %RadioChild, %RadioPopup, %RadioChild)      '%WS_CHILD      = &H40000000
 IF LEN(Txt) = 0                         THEN Txt = "%WS_OVERLAPPED"                : CheckRadioButton(hDlg, %RadioChild, %RadioPopup, %RadioOverlapped) '%WS_OVERLAPPED = 0
 IF (CurrentStyle AND %WS_BORDER)        THEN Txt = Txt & sOr & "%WS_BORDER"        : CheckDlgButton(hDlg, %CheckBorder, %BST_CHECKED) ELSE CheckDlgButton(hDlg, %CheckBorder, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_DLGFRAME)      THEN Txt = Txt & sOr & "%WS_DLGFRAME"      : CheckDlgButton(hDlg, %CheckDlgframe, %BST_CHECKED)      ELSE CheckDlgButton(hDlg, %CheckDlgframe, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_THICKFRAME)    THEN Txt = Txt & sOr & "%WS_THICKFRAME"    : CheckDlgButton(hDlg, %CheckThickframe, %BST_CHECKED)    ELSE CheckDlgButton(hDlg, %CheckThickframe, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_CAPTION)       THEN Txt = Txt & sOr & "%WS_CAPTION"       : CheckDlgButton(hDlg, %CheckCaption, %BST_CHECKED)       ELSE CheckDlgButton(hDlg, %CheckCaption, %BST_UNCHECKED)            'WS_BORDER OR WS_DLGFRAME
 IF (CurrentStyle AND %WS_SYSMENU)       THEN Txt = Txt & sOr & "%WS_SYSMENU"       : CheckDlgButton(hDlg, %CheckSysmenu, %BST_CHECKED)       ELSE CheckDlgButton(hDlg, %CheckSysmenu, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_MINIMIZEBOX)   THEN Txt = Txt & sOr & "%WS_MINIMIZEBOX"   : CheckDlgButton(hDlg, %CheckMinimizebox, %BST_CHECKED)   ELSE CheckDlgButton(hDlg, %CheckMinimizebox, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_MAXIMIZEBOX)   THEN Txt = Txt & sOr & "%WS_MAXIMIZEBOX"   : CheckDlgButton(hDlg, %CheckMaximizebox, %BST_CHECKED)   ELSE CheckDlgButton(hDlg, %CheckMaximizebox, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_MINIMIZE)      THEN Txt = Txt & sOr & "%WS_MINIMIZE"      : CheckDlgButton(hDlg, %CheckMinimize, %BST_CHECKED)   ELSE CheckDlgButton(hDlg, %CheckMaximize, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_MAXIMIZE)      THEN Txt = Txt & sOr & "%WS_MAXIMIZE"      : CheckDlgButton(hDlg, %CheckMaximize, %BST_CHECKED)   ELSE CheckDlgButton(hDlg, %CheckMaximize, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_CLIPSIBLINGS)  THEN Txt = Txt & sOr & "%WS_CLIPSIBLINGS"  : CheckDlgButton(hDlg, %CheckClipsiblings, %BST_CHECKED)  ELSE CheckDlgButton(hDlg, %CheckClipsiblings, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_CLIPCHILDREN)  THEN Txt = Txt & sOr & "%WS_CLIPCHILDREN"  : CheckDlgButton(hDlg, %CheckClipchildren, %BST_CHECKED)  ELSE CheckDlgButton(hDlg, %CheckClipchildren, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_HSCROLL)       THEN Txt = Txt & sOr & "%WS_HSCROLL"       : CheckDlgButton(hDlg, %CheckHscroll, %BST_CHECKED)       ELSE CheckDlgButton(hDlg, %CheckHscroll, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_VSCROLL)       THEN Txt = Txt & sOr & "%WS_VSCROLL"       : CheckDlgButton(hDlg, %CheckVscroll, %BST_CHECKED)       ELSE CheckDlgButton(hDlg, %CheckVscroll, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_VISIBLE)       THEN Txt = Txt & sOr & "%WS_VISIBLE"       : CheckDlgButton(hDlg, %CheckVisible, %BST_CHECKED)       ELSE CheckDlgButton(hDlg, %CheckVisible, %BST_UNCHECKED)
 IF (CurrentStyle AND %WS_DISABLED)      THEN Txt = Txt & sOr & "%WS_DISABLED"      : CheckDlgButton(hDlg, %CheckDisabled, %BST_CHECKED)      ELSE CheckDlgButton(hDlg, %CheckDisabled, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_ABSALIGN)      THEN Txt = Txt & sOr & "%DS_ABSALIGN"      : CheckDlgButton(hDlg, %CheckAbsalign, %BST_CHECKED)      ELSE CheckDlgButton(hDlg, %CheckAbsalign, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_SYSMODAL)      THEN Txt = Txt & sOr & "%DS_SYSMODAL"      : CheckDlgButton(hDlg, %CheckSysmodal, %BST_CHECKED)      ELSE CheckDlgButton(hDlg, %CheckSysmodal, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_MODALFRAME)    THEN Txt = Txt & sOr & "%DS_MODALFRAME"    : CheckDlgButton(hDlg, %CheckModalframe, %BST_CHECKED)    ELSE CheckDlgButton(hDlg, %CheckModalframe, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_SETFOREGROUND) THEN Txt = Txt & sOr & "%DS_SETFOREGROUND" : CheckDlgButton(hDlg, %CheckSetforeground, %BST_CHECKED) ELSE CheckDlgButton(hDlg, %CheckSetforeground, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_CONTROL)       THEN Txt = Txt & sOr & "%DS_CONTROL"       : CheckDlgButton(hDlg, %CheckControl, %BST_CHECKED)       ELSE CheckDlgButton(hDlg, %CheckControl, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_CENTER)        THEN Txt = Txt & sOr & "%DS_CENTER"        : CheckDlgButton(hDlg, %CheckCenter, %BST_CHECKED)        ELSE CheckDlgButton(hDlg, %CheckCenter, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_CENTERMOUSE)   THEN Txt = Txt & sOr & "%DS_CENTERMOUSE"   : CheckDlgButton(hDlg, %CheckCentermouse, %BST_CHECKED)   ELSE CheckDlgButton(hDlg, %CheckCentermouse, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_CONTEXTHELP)   THEN Txt = Txt & sOr & "%DS_CONTEXTHELP"   : CheckDlgButton(hDlg, %CheckContexthelp, %BST_CHECKED)   ELSE CheckDlgButton(hDlg, %CheckContexthelp, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_3DLOOK)        THEN Txt = Txt & sOr & "%DS_3DLOOK"        : CheckDlgButton(hDlg, %Check3dlook, %BST_CHECKED)        ELSE CheckDlgButton(hDlg, %Check3dlook, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_NOFAILCREATE)  THEN Txt = Txt & sOr & "%DS_NOFAILCREATE"  : CheckDlgButton(hDlg, %CheckNofailcreate, %BST_CHECKED)  ELSE CheckDlgButton(hDlg, %CheckNofailcreate, %BST_UNCHECKED)
 IF (CurrentStyle AND %DS_SETFONT)       THEN Txt = Txt & sOr & "%DS_SETFONT"       : CheckDlgButton(hDlg, %CheckSetfont, %BST_CHECKED)       ELSE CheckDlgButton(hDlg, %CheckSetfont, %BST_UNCHECKED)

 IF IsDlgButtonChecked(hDlg, %ButtonUnderscore) THEN
   Txt = Txt & ", _" & $CRLF
 ELSE
   Txt = Txt & "," & $CRLF
 END IF
 Txt = Txt & "_" & $CRLF                                                                                            '  CheckDlgButton(hDlg, %CheckClientedge, %BST_UNCHECKED)     BST_CHECKED
 IF (CurrentExStyle AND %WS_EX_CLIENTEDGE)     THEN Txt = Txt & "%WS_EX_CLIENTEDGE"     & sOr : CheckDlgButton(hDlg, %CheckClientedge, %BST_CHECKED)     ELSE CheckDlgButton(hDlg, %CheckClientedge, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_STATICEDGE)     THEN Txt = Txt & "%WS_EX_STATICEDGE"     & sOr : CheckDlgButton(hDlg, %CheckStaticedge, %BST_CHECKED)     ELSE CheckDlgButton(hDlg, %CheckStaticedge, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_WINDOWEDGE)     THEN Txt = Txt & "%WS_EX_WINDOWEDGE"     & sOr : CheckDlgButton(hDlg, %CheckWindowedge, %BST_CHECKED)     ELSE CheckDlgButton(hDlg, %CheckWindowedge, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_DLGMODALFRAME)  THEN Txt = Txt & "%WS_EX_DLGMODALFRAMEE" & sOr : CheckDlgButton(hDlg, %CheckDlgModalFrame, %BST_CHECKED)  ELSE CheckDlgButton(hDlg, %CheckDlgModalFrame, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_TRANSPARENT)    THEN Txt = Txt & "%WS_EX_TRANSPARENT"    & sOr : CheckDlgButton(hDlg, %CheckTransparent, %BST_CHECKED)    ELSE CheckDlgButton(hDlg, %CheckTransparent, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_ACCEPTFILES)    THEN Txt = Txt & "%WS_EX_ACCEPTFILES"    & sOr : CheckDlgButton(hDlg, %CheckAcceptfiles, %BST_CHECKED)    ELSE CheckDlgButton(hDlg, %CheckAcceptfiles, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_CONTROLPARENT)  THEN Txt = Txt & "%WS_EX_CONTROLPARENT"  & sOr : CheckDlgButton(hDlg, %CheckControlparent, %BST_CHECKED)  ELSE CheckDlgButton(hDlg, %CheckControlparent, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_CONTEXTHELP)    THEN Txt = Txt & "%WS_EX_CONTEXTHELP"    & sOr : CheckDlgButton(hDlg, %CheckContexthelp, %BST_CHECKED)    ELSE CheckDlgButton(hDlg, %CheckContexthelp, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_NOPARENTNOTIFY) THEN Txt = Txt & "%WS_EX_NOPARENTNOTIFY" & sOr : CheckDlgButton(hDlg, %CheckNoparentnotify, %BST_CHECKED) ELSE CheckDlgButton(hDlg, %CheckNoparentnotify, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_TOPMOST)        THEN Txt = Txt & "%WS_EX_TOPMOST"        & sOr : CheckDlgButton(hDlg, %CheckTopmost, %BST_CHECKED)        ELSE CheckDlgButton(hDlg, %CheckTopmost, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_APPWINDOW)      THEN Txt = Txt & "%WS_EX_APPWINDOW"      & sOr : CheckDlgButton(hDlg, %CheckAppwindow, %BST_CHECKED)      ELSE CheckDlgButton(hDlg, %CheckAppwindow, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_MDICHILD)       THEN Txt = Txt & "%WS_EX_MDICHILD"       & sOr : CheckDlgButton(hDlg, %CheckMdiChild, %BST_CHECKED)       ELSE CheckDlgButton(hDlg, %CheckMdiChild, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_TOOLWINDOW)     THEN Txt = Txt & "%WS_EX_TOOLWINDOW"     & sOr : CheckDlgButton(hDlg, %CheckToolWindow, %BST_CHECKED)     ELSE CheckDlgButton(hDlg, %CheckToolWindow, %BST_UNCHECKED)
 IF (CurrentExStyle AND %WS_EX_LAYOUTRTL)      THEN Txt = Txt & "%WS_EX_LAYOUTRTL"      & sOr : CheckDlgButton(hDlg, %CheckLayoutRtl, %BST_CHECKED)      ELSE CheckDlgButton(hDlg, %CheckLayoutRtl, %BST_UNCHECKED)

 IF (CurrentExStyle AND %WS_EX_RIGHT) THEN
   Txt = Txt & "%WS_EX_RIGHT" & sOr
   CheckRadioButton(hDlg, %RadioLeft, %RadioRight, %RadioRight)
 ELSE '%WS_EX_LEFT = &H00000000&
   IF IsDlgButtonChecked(hDlg, %CheckDefaultExStyle) THEN
     Txt = Txt & "%WS_EX_LEFT" & sOr
   END IF
   CheckRadioButton(hDlg, %RadioLeft, %RadioRight, %RadioLeft)
 END IF

 IF (CurrentExStyle AND %WS_EX_RTLREADING) THEN '%WS_EX_RTLREADING = &H00002000&
   Txt = Txt & "%WS_EX_RTLREADING" & sOr
   CheckRadioButton(hDlg, %RadioLtrReading, %RadioRtLReading, %RadioRtLReading)
 ELSE '%WS_EX_LTRREADING = &H00000000&
   IF IsDlgButtonChecked(hDlg, %CheckDefaultExStyle) THEN
     Txt = Txt & "%WS_EX_LTRREADING" & sOr
   END IF
   CheckRadioButton(hDlg, %RadioLtrReading, %RadioRtLReading, %RadioLtrReading)
 END IF

 IF (CurrentExStyle AND %WS_EX_LEFTSCROLLBAR) THEN
   Txt = Txt & "%WS_EX_LEFTSCROLLBAR" & sOr
   CheckRadioButton(hDlg, %RadioLeftScrollbar, %RadioRightScrollbar, %RadioLeftScrollbar)
 ELSE '%RadioRightScrollbar = &H00000000&
   IF IsDlgButtonChecked(hDlg, %CheckDefaultExStyle) THEN
     Txt = Txt & "%WS_EX_RIGHTCROLLBAR" & sOr
   END IF
   CheckRadioButton(hDlg, %RadioLeftScrollbar, %RadioRightScrollbar, %RadioRightScrollbar)
 END IF

 Txt = LEFT$(Txt, -LEN(sOr))

 CONTROL SET TEXT hDlg, %TextboxStyle, Txt
 CONTROL SET TEXT hDlg, %LabelStyleHex, HEX$(CurrentStyle, 8) & " Style in HEX"
 CONTROL SET TEXT hDlg, %LabelExStyleHex, HEX$(CurrentExStyle, 8) & " ExStyle in HEX"

END FUNCTION
'______________________________________________________________________________

CALLBACK FUNCTION DlgProc
 STATIC pt          AS POINTAPI
 LOCAL  Msg         AS TAGMSG
 LOCAL  sBuffer     AS STRING
 LOCAL  DialogStyle AS DWORD
 LOCAL  CheckState  AS LONG
 LOCAL  CharPos     AS LONG
 LOCAL  Looper      AS LONG
 LOCAL  Preset      AS LONG
 LOCAL  ControlId   AS WORD
 LOCAL  MouseMsgId  AS WORD

 SELECT CASE CBMSG

   CASE %WM_INITDIALOG
     PostMessage(hDlg, %WM_InitDialogDone, 0, 0)

   CASE %WM_InitDialogDone
     DO WHILE PeekMessage(Msg, 0, 0, 0, %PM_NOREMOVE)
       DIALOG DOEVENTS 1 'Let DDT handle all pending messages
     LOOP
     FileIniRead()
     GetStyle
     CONTROL SET TEXT hDlg, %TextboxInfo, $Info

   CASE %WM_LBUTTONDOWN
     IF CBWPARAM = %MK_LBUTTON THEN
       SendMessage(hDlg, %WM_NCLBUTTONDOWN, %HTCAPTION, BYVAL %NULL) 'Simulate click down on caption
       '%WM_LBUTTONUP will be sent to the control
     END IF

   CASE %WM_SETCURSOR
     MouseMsgId = (CBLPARAM \ &H10000) 'Or HI(WORD, CBLPARAM)
     IF (MouseMsgId = %WM_LBUTTONDOWN) OR (MouseMsgId = %WM_RBUTTONDOWN) THEN
       GetCursorPos(pt)
       ScreenToClient(hDlg, pt)
     END IF

   CASE %WM_CONTEXTMENU
     'hwnd = wParam,  xPos = LOWORD(lParam), yPos = HIWORD(lParam)
      ControlId  = GetDlgCtrlID(CBWPARAM)
      IF ControlId THEN
        RightClick = %TRUE
        PostMessage(hdlg, %WM_COMMAND, MAKDWD(ControlId, %BN_CLICKED), CBWPARAM)
      ELSE
        CONTROL SET TEXT hDlg, %TextboxInfo, $Info
      END IF

   CASE %WM_THEMECHANGED
     'WinBeep(1500, 100)

   CASE %WM_COMMAND
     ControlId  = LOWRD(CBWPARAM)

     IF (CBCTLMSG = %STN_DBLCLK) OR (CBCTLMSG = 1) THEN
       CONTROL GET TEXT hDlg, ControlId TO sBuffer
       sBuffer = LEFT$(sBuffer, 8)
       IF ControlId = %LabelStyleHex THEN
         CONTROL SET TEXT hDlg, %TextboxStyleHex, sBuffer
       END IF
       IF ControlId = %LabelExStyleHex THEN
         CONTROL SET TEXT hDlg, %TextboxExStyleHex, sBuffer
       END IF
     END IF

     IF (CBCTLMSG = %BN_CLICKED) OR (CBCTLMSG = 1) THEN
       CONTROL GET CHECK hDlg, ControlId TO CheckState
       SELECT CASE ControlId

         CASE %ButtonStyleOr
           CONTROL SET TEXT hDlg, %TextboxInfo, "The style will be ORed with the proposed value." & _
                                                $CRLF & "Double-click on above static to copy it."
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             CONTROL GET TEXT hDlg, %TextboxStyleHex TO sBuffer
             IF LEN(sBuffer) = 0 THEN
               sBuffer = "0"
               CONTROL SET TEXT hDlg, %TextboxStyleHex, sBuffer
             END IF
             SetWindowLong(hDlg, %GWL_STYLE, (GetWindowLong(hDlg, %GWL_STYLE) OR VAL("&h" & sBuffer)))
           END IF

         CASE %ButtonStyleAnd
           CONTROL SET TEXT hDlg, %TextboxInfo, "The style will be ANDed with the proposed value, except for WS_VISIBLE (0x10000000)." & _
                                                $CRLF & "Double-click on above static to copy it."
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             CONTROL GET TEXT hDlg, %TextboxStyleHex TO sBuffer
             IF LEN(sBuffer) = 0 THEN
               sBuffer = "0"
               CONTROL SET TEXT hDlg, %TextboxStyleHex, sBuffer
             END IF
             DialogStyle = (VAL("&h" & sBuffer) OR &H10000000) 'Avoid to reset WS_VISIBLE
             CONTROL SET TEXT hDlg, %TextboxStyleHex, HEX$(DialogStyle, 8)
             SetWindowLong(hDlg, %GWL_STYLE, (GetWindowLong(hDlg, %GWL_STYLE) AND DialogStyle))
           END IF

         CASE %ButtonExStyleOr
           CONTROL SET TEXT hDlg, %TextboxInfo, "The extended style will be ORed with the proposed value." & _
                                                $CRLF & "Double-click on above static to copy it."
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             CONTROL GET TEXT hDlg, %TextboxExStyleHex TO sBuffer
             IF LEN(sBuffer) = 0 THEN
               sBuffer = "0"
               CONTROL SET TEXT hDlg, %TextboxExStyleHex, sBuffer
             END IF
             SetWindowLong(hDlg, %GWL_EXSTYLE, (GetWindowLong(hDlg, %GWL_EXSTYLE) OR VAL("&h" & sBuffer)))
           END IF
         CASE %ButtonExStyleAnd
           CONTROL SET TEXT hDlg, %TextboxInfo, "The extended style will be ANDed with the proposed value." & _
                                                $CRLF & "Double-click on above static to copy it."
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             CONTROL GET TEXT hDlg, %TextboxExStyleHex TO sBuffer
             IF LEN(sBuffer) = 0 THEN
               sBuffer = "0"
               CONTROL SET TEXT hDlg, %TextboxExStyleHex, sBuffer
             END IF
             SetWindowLong(hDlg, %GWL_EXSTYLE, (GetWindowLong(hDlg, %GWL_EXSTYLE) AND VAL("&h" & sBuffer)))
           END IF

         CASE %ButtonPreset01 TO %ButtonPreset01 + %PresetCount - 1
           Preset = 1 + ControlId - %ButtonPreset01
           IF (GetAsyncKeyState(%VK_CONTROL) AND &H8000) THEN 'Control key down
             PresetStyle(Preset)   = GetWindowLong(hDlg, %GWL_STYLE)
             PresetExStyle(Preset) = GetWindowLong(hDlg, %GWL_EXSTYLE)
             CONTROL SET TEXT hDlg, %TextboxInfo, "Preset" & STR$(Preset) & " recorded." & $CRLF & $CRLF & _
             "Style = 0x" & HEX$(PresetStyle(Preset), 8) & $CRLF & _
             "Extendex style = 0x" & HEX$(PresetExStyle(Preset), 8)
           ELSE
             IF RightClick THEN
               RightClick = %FALSE
               CONTROL SET TEXT hDlg, %TextboxInfo, $Preset
             ELSE
               IF PresetStyle(Preset) THEN
                 CONTROL SET TEXT hDlg, %TextboxInfo, _
                 "Preset " & FORMAT$(Preset) & " called." & $CRLF & _
                 "Style = 0x" & HEX$(PresetStyle(Preset), 8) & $CRLF & _
                 "Extendex style = 0x" & HEX$(PresetExStyle(Preset), 8) & $CRLF & $CRLF & _
                 $Preset
                 SetWindowLong(hDlg, %GWL_STYLE, PresetStyle(Preset))
                 SetWindowLong(hDlg, %GWL_EXSTYLE, PresetExStyle(Preset))
               ELSE
                 CONTROL SET TEXT hDlg, %TextboxInfo, $Preset & $CRLF & $CRLF & _
                 "Nothing recorded yet on Preset " & FORMAT$(Preset) & "."
               END IF
             END IF
           END IF

         CASE %IDCANCEL
           DIALOG END hDlg

         CASE %RadioPopup
           StyleSet(%WS_POPUP) '%WS_POPUP %WS_CHILD %WS_OVERLAPPED
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_POPUP
         CASE %RadioOverlapped
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_OVERLAPPED1 & $WS_OVERLAPPED2
           StyleSet(%WS_OVERLAPPED) '%WS_POPUP %WS_CHILD %WS_OVERLAPPED
         CASE %RadioChild
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_CHILD
           StyleSet(%WS_CHILD) '%WS_POPUP %WS_CHILD %WS_OVERLAPPED

         CASE %CheckBorder
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_BORDER
           StyleFlip(%WS_BORDER, CheckState)
         CASE %CheckDlgframe
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_DLGFRAME
           StyleFlip(%WS_DLGFRAME, CheckState)
         CASE %CheckThickframe
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_THICKFRAME
           StyleFlip %WS_THICKFRAME, CheckState
         CASE %CheckCaption
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_CAPTION
           StyleFlip %WS_CAPTION, CheckState
         CASE %CheckSysmenu
           StyleFlip(%WS_SYSMENU, CheckState)
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_SYSMENU
         CASE %CheckMinimizebox
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_MINIMIZEBOX
           StyleFlip %WS_MINIMIZEBOX, CheckState
         CASE %CheckMaximizebox
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_MAXIMIZEBOX
           StyleFlip(%WS_MAXIMIZEBOX, CheckState)
         CASE %CheckMinimize
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_MINIMIZE
           StyleFlip(%WS_MINIMIZE, CheckState)
         CASE %CheckMaximize
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_MAXIMIZE
           StyleFlip(%WS_MAXIMIZE, CheckState)
         CASE %CheckClipsiblings
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_CLIPSIBLINGS1 & _
           $WS_CLIPSIBLINGS2 & $WS_CLIPSIBLINGS3 & $WS_CLIPSIBLINGS4
           FOR Looper = 1 TO 25
             DIALOG DOEVENTS 1 'Give the OS time to erase the checkmark if Common-Controls 6
           NEXT
           StyleFlip(%WS_CLIPSIBLINGS, CheckState)
         CASE %CheckClipchildren
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_CLIPCHILDREN
           StyleFlip(%WS_CLIPCHILDREN, CheckState)
         CASE %CheckHscroll
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_HSCROLL
           StyleFlip(%WS_HSCROLL, CheckState)
         CASE %CheckVscroll
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_VSCROLL
           StyleFlip(%WS_VSCROLL, CheckState)
         CASE %CheckVisible
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_VISIBLE
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             FOR Looper = 1 TO 15
               DIALOG DOEVENTS 1 'Give the OS time to erase the checkmark if Common-Controls 6
             NEXT
             ShowWindow(hDlg, %FALSE)
             SLEEP 1000
             ShowWindow(hDlg, %TRUE)
           END IF
         CASE %CheckDisabled
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_DISABLED
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             FOR Looper = 1 TO 15
               DIALOG DOEVENTS 1 'Give the OS time to draw the checkmark if Common-Controls 6
             NEXT
             EnableWindow(hDlg, %FALSE)
             GetStyle
             SLEEP 5000
             EnableWindow(hDlg, %TRUE)
             CONTROL SET CHECK hDlg, %CheckDisabled, %FALSE
           END IF

         CASE %CheckAbsalign
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_ABSALIGN
           StyleFlip(%DS_ABSALIGN, CheckState)
         CASE %CheckSysmodal
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_SYSMODAL1 & _
           $DS_SYSMODAL2 & $DS_SYSMODAL3
           StyleFlip %DS_SYSMODAL, CheckState
         CASE %CheckModalframe
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_MODALFRAME
           StyleFlip(%DS_MODALFRAME, CheckState)
         CASE %CheckSetforeground
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_SETFOREGROUND1 & _
           $DS_SETFOREGROUND2 & $DS_SETFOREGROUND3
           StyleFlip(%DS_SETFOREGROUND, CheckState)
         CASE %CheckControl
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_CONTROL1 & $DS_CONTROL2
           StyleFlip(%DS_CONTROL, CheckState)
         CASE %CheckCenter
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_CENTER1 & $DS_CENTER2
           StyleFlip(%DS_CENTER, CheckState)
         CASE %CheckCentermouse
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_CENTERMOUSE
           StyleFlip %DS_CENTERMOUSE, CheckState
         CASE %CheckContexthelp
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_CONTEXTHELP1 & $DS_CONTEXTHELP2 & _
           $DS_CONTEXTHELP3 & $DS_CONTEXTHELP4 & $DS_CONTEXTHELP5 & $DS_CONTEXTHELP6
           StyleFlip(%DS_CONTEXTHELP, CheckState)
         CASE %Check3dlook
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_3DLOOK1 & $DS_3DLOOK2 & $DS_3DLOOK3
           StyleFlip(%DS_3DLOOK, CheckState)
         CASE %CheckNofailcreate
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_NOFAILCREATE
           StyleFlip(%DS_NOFAILCREATE, CheckState)
         CASE %CheckSetfont
           StyleFlip(%DS_SETFONT, CheckState)
           CONTROL SET TEXT hDlg, %TextboxInfo, $DS_SETFONT1 & _
           $DS_SETFONT2 & $DS_SETFONT3 & $DS_SETFONT4

         CASE %CheckClientedge
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_CLIENTEDGE
           ExStyleFlip(%WS_EX_CLIENTEDGE, CheckState)
         CASE %CheckStaticedge
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_STATICEDGE
           ExStyleFlip(%WS_EX_STATICEDGE, CheckState)
         CASE %CheckWindowedge
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_WINDOWEDGE
           ExStyleFlip(%WS_EX_WINDOWEDGE, CheckState)
         CASE %CheckDlgModalFrame
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_DLGMODALFRAME
           ExStyleFlip(%WS_EX_DLGMODALFRAME, CheckState)
         CASE %CheckTransparent
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_TRANSPARENT1 & _
           $WS_EX_TRANSPARENT2 & $WS_EX_TRANSPARENT3
           ExStyleFlip(%WS_EX_TRANSPARENT, CheckState)
         CASE %CheckAcceptfiles
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_ACCEPTFILES
           ExStyleFlip(%WS_EX_ACCEPTFILES, CheckState)
         CASE %CheckControlparent
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_CONTROLPARENT1 & $WS_EX_CONTROLPARENT2
           ExStyleFlip(%WS_EX_CONTROLPARENT, CheckState)
         CASE %CheckExContexthelp
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_CONTEXTHELP1 & $WS_EX_CONTEXTHELP2 & _
           $WS_EX_CONTEXTHELP3 & $WS_EX_CONTEXTHELP4
           ExStyleFlip(%WS_EX_CONTEXTHELP, CheckState)
         CASE %CheckNoparentnotify
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_NOPARENTNOTIFY
           ExStyleFlip(%WS_EX_NOPARENTNOTIFY, CheckState)
         CASE %CheckTopmost
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_TOPMOST1 & $WS_EX_TOPMOST2
           ExStyleFlip(%WS_EX_TOPMOST, CheckState)
         CASE %CheckAppwindow
           ExStyleFlip(%WS_EX_APPWINDOW, CheckState)
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_APPWINDOW
         CASE %CheckMdiChild
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_MDICHILD
           ExStyleFlip(%WS_EX_MDICHILD, CheckState)
         CASE %CheckToolWindow
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_TOOLWINDOW1 & _
           $WS_EX_TOOLWINDOW2 & $WS_EX_TOOLWINDOW3 & $WS_EX_TOOLWINDOW4
           ExStyleFlip(%WS_EX_TOOLWINDOW, CheckState)
         CASE %CheckLayoutRtl
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_LAYOUTRTL1 & $WS_EX_LAYOUTRTL2
           ExStyleFlip(%WS_EX_LAYOUTRTL, CheckState)

         CASE %CheckTheme 'In Windows 8, it is not possible to turn off visual styles.
           CONTROL SET TEXT hDlg, %TextboxInfo, $Theme
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             IF IsDlgButtonChecked(hDlg, %CheckTheme) THEN
               SetWindowTheme(hDlg, "", "") '#32770 (Dialog) - Add theme
             ELSE
               SetWindowTheme(hDlg, "", "#32770") '#32770 (Dialog) - Remove theme
             END IF
             SetWindowPos(hDlg, %HWND_TOP, 0, 0, 0, 0, %SWP_FRAMECHANGED OR %SWP_NOSIZE OR %SWP_NOMOVE)
           END IF

         CASE %RadioLeft
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_LEFT
           IF CheckState THEN
             ExStyleFlip(%WS_EX_RIGHT, 0) '%WS_EX_LEFT = 0
           END IF
         CASE %RadioRight
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_RIGHT1 & $WS_EX_RIGHT2
           IF CheckState THEN
             ExStyleFlip(%WS_EX_RIGHT, 1) '%WS_EX_LEFT = 0
           END IF
         CASE %RadioLtrReading
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_LTRREADING
           IF CheckState THEN
             ExStyleFlip(%WS_EX_RTLREADING, 0) '%WS_EX_LTRREADING = 0
           END IF
         CASE %RadioRtlReading
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_RTLREADING1 & $WS_EX_RTLREADING2
           IF CheckState THEN
             ExStyleFlip(%WS_EX_RTLREADING, 1) '%WS_EX_LTRREADING = 0
           END IF
         CASE %RadioRightScrollbar
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_RIGHTSCROLLBAR
           IF CheckState THEN
             ExStyleFlip(%WS_EX_LEFTSCROLLBAR, 0) '%WS_EX_RIGHTSCROLLBAR = 0
           END IF
         CASE %RadioLeftScrollbar
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_EX_LEFTSCROLLBAR1 & $WS_EX_LEFTSCROLLBAR2
           IF CheckState THEN
             ExStyleFlip(%WS_EX_LEFTSCROLLBAR, 1) '%WS_EX_RIGHTSCROLLBAR = 0
           END IF
         CASE %CheckDefaultExStyle
           CONTROL SET TEXT hDlg, %TextboxInfo, $DefaultExStyle

         CASE %ButtonPopupWindow
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_POPUPWINDOW
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             StyleSet(%WS_POPUP) '%WS_POPUP %WS_CHILD %WS_OVERLAPPED
             StyleFlip(%WS_BORDER, %TRUE)
             StyleFlip(%WS_SYSMENU, %TRUE)
           END IF
         CASE %ButtonOverlappedWindow
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_OVERLAPPEDWINDOW1 & $WS_OVERLAPPEDWINDOW2
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             StyleSet(%WS_OVERLAPPED) '%WS_POPUP %WS_CHILD %WS_OVERLAPPED
             StyleFlip(%WS_CAPTION, %TRUE)
             StyleFlip(%WS_SYSMENU, %TRUE)
             StyleFlip(%WS_THICKFRAME, %TRUE)
             StyleFlip(%WS_MINIMIZEBOX, %TRUE)
             StyleFlip(%WS_MAXIMIZEBOX, %TRUE)
           END IF
         CASE %ButtonOverlappedWin
           CONTROL SET TEXT hDlg, %TextboxInfo, $WS_OVERLAPPEDWIN
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             'WS_OVERLAPPEDWIN = WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME (PowerBASIC only)
             StyleSet(%WS_OVERLAPPED) '%WS_POPUP %WS_CHILD %WS_OVERLAPPED
             StyleFlip(%WS_CAPTION, %TRUE)
             StyleFlip(%WS_SYSMENU, %TRUE)
             StyleFlip(%WS_THICKFRAME, %TRUE)
           END IF

         CASE %ButtonUnderscore
           CONTROL SET TEXT hDlg, %TextboxInfo, "Add line continuation character or not."

         CASE %ButtonClipboard
           CONTROL SET TEXT hDlg, %TextboxInfo, "Copy to clipboard, with continuation characters or not." & $CRLF & "Then paste in code"
           CONTROL GET TEXT hDlg, %TextboxStyle TO sBuffer
           IF IsDlgButtonChecked(hDlg, %ButtonUnderscore) THEN 'sUnderscore = "_"
           ELSE 'sUnderscore = ""
             REPLACE "OR " & $CRLF WITH "OR " IN sBuffer
             REPLACE "," & $CRLF & "_" WITH ", _" IN sBuffer
           END IF
           ClipboardSet(sBuffer)

         CASE %ButtonReset
           CONTROL SET TEXT hDlg, %TextboxInfo, "Reset all styles and extended styles. Except WS_VISIBLE (0x10000000)"
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             SetWindowLong(hDlg, %GWL_STYLE, &H10000000) 'Avoid to reset WS_VISIBLE (0x10000000)
             SetWindowLong(hDlg, %GWL_EXSTYLE, &H00000000)
             SetWindowTheme(hDlg, "", "") '#32770 (Dialog)
             CheckDlgButton(hDlg, %CheckTheme, %BST_CHECKED)
           END IF

         CASE %ButtonQuit
           CONTROL SET TEXT hDlg, %TextboxInfo, "Quit."
           IF RightClick THEN
             RightClick = %FALSE
           ELSE
             DIALOG END hDlg
           END IF

       END SELECT

       IF (ControlId <> %RadioOverlapped) AND _
          (ControlId <> %CheckLayoutRtl)  AND _
          (ControlId <> %CheckDisabled) THEN
         ClientToScreen(hDlg, pt) 'Ici 2
         SetCursorPos(pt.x, pt.y)
       END IF

       GetStyle

     END IF

   CASE %WM_CLOSE
     FileIniSave()

   CASE %WM_DESTROY

  END SELECT

END FUNCTION
'______________________________________________________________________________

FUNCTION PBMAIN()
 LOCAL hIconBig                       AS DWORD
 LOCAL hIconSmall                     AS DWORD
 DIM PresetStyle(1 TO %PresetCount)   AS GLOBAL DWORD
 DIM PresetExStyle(1 TO %PresetCount) AS GLOBAL DWORD

 DIALOG FONT "Segoe UI", 9
 DIALOG NEW %HWND_DESKTOP ,"Dialog with style...", , , 370, 415, _
 %WS_POPUP OR _
 %WS_BORDER OR _
 %WS_DLGFRAME OR _
 %WS_CAPTION OR _
 %WS_SYSMENU OR _
 %WS_MINIMIZEBOX OR _
 %WS_CLIPSIBLINGS OR _
 %WS_VISIBLE OR _
 %DS_CENTER OR _
 %DS_3DLOOK OR _
 %DS_NOFAILCREATE OR _
 %DS_SETFONT, _
 %WS_EX_WINDOWEDGE OR _
 %WS_EX_CONTROLPARENT OR _
 %WS_EX_CONTEXTHELP _
 TO hDlg

 ExtractIconEx("Shell32.dll", 2, BYVAL VARPTR(hIconBig), BYVAL VARPTR(hIconSmall), 1) '27 76
 SetClassLong(hDlg, %GCL_HICONSM, hIconSmall) 'Set icon
 SetClassLong(hDlg, %GCL_HICON,   hIconBig)   'Set icon
 SendMessage(hDlg, %WM_SETICON, %ICON_SMALL, hIconSmall)
 SendMessage(hDlg, %WM_SETICON, %ICON_BIG,   hIconBig)

 CONTROL ADD OPTION, hDlg, %RadioChild,           "WS_CHILD",               15,   5,  60,  12, %WS_GROUP OR %WS_TABSTOP
 CONTROL ADD OPTION, hDlg, %RadioOverlapped,      "WS_OVERLAPPED",          15,  15,  65,  12
 CONTROL ADD OPTION, hDlg, %RadioPopup,           "WS_POPUP",               15,  25,  60,  12

 CONTROL ADD BUTTON,  hDlg, %ButtonOverlappedWindow, "OverlappedWindow",    85,   3,  80,  12, %WS_GROUP OR %WS_TABSTOP
 CONTROL ADD BUTTON,  hDlg, %ButtonOverlappedWin,    "OverlappedWin",       85,  15,  80,  12
 CONTROL ADD BUTTON,  hDlg, %ButtonPopupWindow,      "PopupWindow",         85,  27,  80,  12

 CONTROL ADD BUTTON,  hDlg, %ButtonReset,          "Reset",                175,   3,  50,  12, %WS_GROUP OR %WS_TABSTOP
 CONTROL ADD BUTTON,  hDlg, %ButtonQuit,           "Quit",                 175,  15,  50,  12
 CONTROL ADD BUTTON,  hDlg, %ButtonUnderscore,     "_",                    215,  27,  10,  12, _
 %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_AUTOCHECKBOX OR %BS_PUSHLIKE OR %BS_DEFAULT, %WS_EX_LEFT
 CONTROL ADD BUTTON,  hDlg, %ButtonClipboard,      "Copy",                 175,  27,  40,  12

 CONTROL ADD LABEL,   hDlg, %LabelStyleHex,     "00000000 Style in HEX",    18,  40,  80,  10, %SS_NOTIFY 'SS_NOTIFY = Double click to copy in clipboerd
 CONTROL ADD TEXTBOX, hDlg, %TextboxStyleHex,   "00000000",                 15,  50,  40,  10
 CONTROL ADD BUTTON,  hDlg, %ButtonStyleOr,     "OR",                       55,  50,  20,  10
 CONTROL ADD BUTTON,  hDlg, %ButtonStyleAnd,    "AND",                      75,  50,  20,  10

 CONTROL ADD LABEL,   hDlg, %LabelExStyleHex,   "00000000 ExStyle in HEX", 123,  40,  80,  10, %SS_NOTIFY 'SS_NOTIFY = Double click to copy in clipboerd
 CONTROL ADD TEXTBOX, hDlg, %TextboxExStyleHex,   "00000000",              120,  50,  40,  10
 CONTROL ADD BUTTON,  hDlg, %ButtonExStyleOr,     "OR",                    160,  50,  20,  10
 CONTROL ADD BUTTON,  hDlg, %ButtonExStyleAnd,    "AND",                   180,  50,  20,  10

 CONTROL ADD CHECKBOX, hDlg, %CheckBorder,        "WS_BORDER",              15,  65,  90,   9, %WS_GROUP OR %WS_TABSTOP
 CONTROL ADD CHECKBOX, hDlg, %CheckDlgframe,      "WS_DLGFRAME",            15,  75,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckThickframe,    "WS_THICKFRAME",          15,  85,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckCaption,       "WS_CAPTION",             15,  95,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckSysmenu,       "WS_SYSMENU",             15, 105,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckMinimizebox,   "WS_MINIMIZEBOX",         15, 115,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckMaximizebox,   "WS_MAXIMIZEBOX",         15, 125,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckMinimize,      "WS_MINIMIZE",            15, 135,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckMaximize,      "WS_MAXIMIZE",            15, 145,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckClipsiblings,  "WS_CLIPSIBLINGS",        15, 155,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckClipchildren,  "WS_CLIPCHILDREN",        15, 165,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckHscroll,       "WS_HSCROLL",             15, 175,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckVscroll,       "WS_VSCROLL",             15, 185,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckVisible,       "WS_VISIBLE (1 seconds)", 15, 195,  90,   9
 CONTROL SET CHECK     hDlg, %CheckVisible, %TRUE
 CONTROL ADD CHECKBOX, hDlg, %CheckDisabled,      "WS_DISABLED (5 seconds)",15, 205,  90,   9

 CONTROL ADD CHECKBOX, hDlg, %CheckAbsalign,       "DS_ABSALIGN",           15, 225,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckSysmodal,       "DS_SYSMODAL",           15, 235,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckModalframe,     "DS_MODALFRAME",         15, 245,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckSetforeground,  "DS_SETFOREGROUND",      15, 255,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckControl,        "DS_CONTROL",            15, 265,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckCenter,         "DS_CENTER",             15, 275,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckCentermouse,    "DS_CENTERMOUSE",        15, 285,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckContexthelp,    "DS_CONTEXTHELP",        15, 295,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %Check3dlook,         "DS_3DLOOK",             15, 305,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckNofailcreate,   "DS_NOFAILCREATE",       15, 315,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckSetfont,        "DS_SETFONT",            15, 325,  90,   9

 CONTROL ADD CHECKBOX, hDlg, %CheckClientedge,     "WS_EX_CLIENTEDGE",     120,  65,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckStaticedge,     "WS_EX_STATICEDGE",     120,  75,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckWindowedge,     "WS_EX_WINDOWEDGE",     120,  85,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckTransparent,    "WS_EX_TRANSPARENT",    120,  95,  90,   9

 CONTROL ADD CHECKBOX, hDlg, %CheckDlgModalFrame,  "WS_EX_DLGMODALFRAME",  120, 105,  90,   9

 CONTROL ADD CHECKBOX, hDlg, %CheckAcceptfiles,    "WS_EX_ACCEPTFILES",    120, 115,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckControlparent,  "WS_EX_CONTROLPARENT",  120, 125,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckExContexthelp,  "WS_EX_CONTEXTHELP",  120, 135,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckNoparentnotify, "WS_EX_NOPARENTNOTIFY", 120, 145,  93,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckTopmost,        "WS_EX_TOPMOST",        120, 155,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckAppwindow,      "WS_EX_APPWINDOW",      120, 165,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckMdiChild,       "WS_EX_MDICHILD",       120, 175,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckToolWindow,     "WS_EX_TOOLWINDOW",     120, 185,  90,   9
 CONTROL ADD CHECKBOX, hDlg, %CheckLayoutRtl,      "WS_EX_LAYOUTRTL",      120, 195,  90,   9

 CONTROL ADD OPTION,   hDlg, %RadioLeft,           "WS_EX_LEFT",           120, 210,  90,   9, %WS_GROUP
 CONTROL ADD OPTION,   hDlg, %RadioRight,          "WS_EX_RIGHT",          120, 220,  90,   9

 CONTROL ADD OPTION,   hDlg, %RadioLtrReading,     "WS_EX_LTRREADING",     120, 235,  90,   9, %WS_GROUP
 CONTROL ADD OPTION,   hDlg, %RadioRtlReading,     "WS_EX_RTLREADING",     120, 245,  90,   9

 CONTROL ADD OPTION, hDlg, %RadioLeftScrollbar,    "WS_EX_LEFTSCROLLBAR",  120, 260,  90,   9
 CONTROL ADD OPTION, hDlg, %RadioRightScrollbar,   "WS_EX_RIGHTSCROLLBAR", 120, 270,  90,   9, %WS_GROUP

 CONTROL ADD CHECKBOX, hDlg, %CheckDefaultExStyle, "Add default ex style", 120, 290,  90,   9

 CONTROL ADD CHECKBOX, hDlg, %CheckTheme,          "Theme",                120, 300,  90,   9

 CONTROL ADD TEXTBOX, hDlg, %TextboxStyle,         "Style",                235,   5, 130, 300, _
 %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_WANTRETURN, _
 %WS_EX_CLIENTEDGE OR %WS_EX_RIGHTSCROLLBAR

 CONTROL ADD TEXTBOX, hDlg, %TextboxInfo,          "Info",                 115, 315, 250,  60, _
 %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_WANTRETURN, _
 %WS_EX_CLIENTEDGE OR %WS_EX_RIGHTSCROLLBAR

 CONTROL ADD BUTTON,  hDlg, %ButtonPreset01,       "Preset 1",              15, 340,  43,  12
 CONTROL ADD BUTTON,  hDlg, %ButtonPreset02,       "Preset 2",              15, 352,  43,  12
 CONTROL ADD BUTTON,  hDlg, %ButtonPreset03,       "Preset 3",              15, 364,  43,  12
 CONTROL ADD BUTTON,  hDlg, %ButtonPreset04,       "Preset 4",              67, 340,  43,  12
 CONTROL ADD BUTTON,  hDlg, %ButtonPreset05,       "Preset 5",              67, 352,  43,  12
 CONTROL ADD BUTTON,  hDlg, %ButtonPreset06,       "Preset 6",              67, 364,  43,  12

 DIALOG SHOW MODAL hDlg CALL DlgProc

 DestroyIcon(hIconSmall)
 DestroyIcon(hIconBig)

END FUNCTION
'______________________________________________________________________________
'