Change Border Style of Dialogs

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Change Border Style of Dialogs

Post by Marcus Tettmar » Wed Mar 16, 2005 7:23 pm

This example creates a dialog and changes it's border style to non-sizeable with no Minimize or Maximize button.

Dialog>Dialog1
Caption=MyDialog
Top=121
Width=226
Left=77
Height=140
Label=Hello World,40,24
Button=OK,48,48,75,25,2
EndDialog>Dialog1

Let>WS_CAPTION=12582912
Let>WS_MINIMIZEBOX=131072
Let>WS_MAXIMIZEBOX=65536
Let>WS_SYSMENU=524288
Let>WS_THICKFRAME=262144

//change the style of MyDialog to non-sizeable with a system menu,
//but no max or min boxes
Show>Dialog1
LibFunc>user32,FindWindowA,dhwnd,TForm,MyDialog
Let>style={%WS_CAPTION% OR %WS_SYSMENU%}
LibFunc>user32,SetWindowLongA,sres,dhwnd,-16,style
CloseDialog>Dialog1
Show>Dialog1,r

To change the style OR different values together. E.g. to add a Mazimize box:

Let>style={%WS_CAPTION% OR %WS_SYSMENU% OR %WS_MAXIMIZEBOX%}

To have no system menu or Minimize or Mazimize buttons:

Let>style={%WS_CAPTION%}

To make it sizeable:

Let>style={%WS_CAPTION% OR %WS_THICKFRAME%}

Just OR whichever option you want to create the style you want.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue May 16, 2006 9:15 pm

Here's a dialog with no border. It displays for 5 seconds then closes:

Dialog>Dialog1
Caption=MyDialog
Top=121
Width=226
Left=77
Height=140
Label=Hello World,40,24
EndDialog>Dialog1

Let>WS_CAPTION=12582912
Let>WS_MINIMIZEBOX=131072
Let>WS_MAXIMIZEBOX=65536
Let>WS_SYSMENU=524288
Let>WS_THICKFRAME=262144
Let>WS_POPUP=2147483648
Let>WS_CHILD=1073741824

//change the style of MyDialog to non-sizeable with a system menu,
//but no max or min boxes
Show>Dialog1
LibFunc>user32,FindWindowA,dhwnd,TForm,MyDialog
Let>style=WS_CHILD
LibFunc>user32,SetWindowLongA,sres,dhwnd,-16,style
CloseDialog>Dialog1
Show>Dialog1
Wait>5
CloseDialog>Dialog1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts