Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Non rectangular dialogs
I removed the caption because it looks better, to move the dialog just click on it.
With some work it could be used to have true skins instead of only backgrounds , drawing a custom caption with buttons on it.
You can move the dialog only when you click on the fake caption or any control with a little more work.
There is a small drawback if you remove the caption , you can't minimize the dialog clicking on the taskbar icon, you have to right click and choose minimize , it also happens with QuickTime that uses a similar window.
;Smooth dialog edges ;Guido 12/02 IntControl(1002,0,0,0,0) ;no winbatch icon IntControl(49,1,0,0,0) ;system menu #definesubroutine dlgproc(handle,msg,id,p4,p5) select msg case 0 ;Init DialogProcOptions(handle,2,1) ;buttons DialogProcOptions(handle,1,100) ;timer GWL_STYLE=-16 WS_CAPTION=12582912 HTCAPTION=2 WM_NCLBUTTONDOWN=161 user32=strcat(dirwindows(1),"user32.dll") gdi32=strcat(dirwindows(1),"gdi32.dll") dlgid=WinIdGet("") RECT=binaryalloc(16) ;remove caption os=dllcall(user32,long:"GetWindowLongA",long:handle,long:GWL_STYLE) dllcall(user32,long:"SetWindowLongA",long:handle,long:GWL_STYLE,long:os & ~WS_CAPTION) ;create region dllcall(user32,long:"GetClientRect",long:handle,lpbinary:RECT) hrgn=dllcall(gdi32,long:"CreateRoundRectRgn",long:0,long:0,long:binarypeek4(RECT,8),long:binarypeek4(RECT,12),long:100,long:100) dllcall(user32,long:"SetWindowRgn",long:handle,long:hrgn,long:@true) binaryfree(RECT) case 1 ;timer ;move dlg when clicking on it if MouseInfo(8)==4 if MouseInfo(9)==dlgid then dllcall(user32,long:"SendMessageA",long:handle,long:WM_NCLBUTTONDOWN,long:HTCAPTION,lpnull) endif break case 2 ;buttons select id case 1 ;hide dllcall(user32,long:"CloseWindow",long:handle) return -2 endselect endselect return -1 #endsubroutine MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`WIL Dialog 1` MyDialogX=-1 MyDialogY=-1 MyDialogWidth=142 MyDialogHeight=136 MyDialogNumControls=002 MyDialogProcedure=`dlgproc` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,255|255|0` MyDialogConfig=4513660 MyDialog001=`017,103,036,012,PUSHBUTTON,DEFAULT,"Hide",1,1,32,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`083,103,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog",1)
;Non rectangular dialogs ;Guido 12/02 IntControl(1002,0,0,0,0) ;no winbatch icon IntControl(49,1,0,0,0) ;system menu #definesubroutine dlgproc(handle,msg,id,p4,p5) select msg case 0 ;Init DialogProcOptions(handle,2,1) ;buttons DialogProcOptions(handle,1,100) ;timer WS_CAPTION=12582912 HTCAPTION=2 WM_NCLBUTTONDOWN=161 user32=strcat(dirwindows(1),"user32.dll") gdi32=strcat(dirwindows(1),"gdi32.dll") dlgid=WinIdGet("") RECT=binaryalloc(16) WINDING=2 ;array of POINT structures ;3 points * 8 bytes each = 24 POINTARR=binaryalloc(24) ;dlg width & heigth dllcall(user32,long:"GetWindowRect",long:handle,lpbinary:RECT) dlgwidth=binarypeek4(RECT,8)-binarypeek4(RECT,0) dlgheight=binarypeek4(RECT,12)-binarypeek4(RECT,4) ;1st point binarypoke4(POINTARR,0,5) binarypoke4(POINTARR,4,dlgheight-20) ;2nd point binarypoke4(POINTARR,8,dlgwidth/2) binarypoke4(POINTARR,12,30) ;3rd point binarypoke4(POINTARR,16,dlgwidth-5) binarypoke4(POINTARR,20,dlgheight-20) ;create region hrgn=dllcall(gdi32,long:"CreatePolygonRgn",lpbinary:POINTARR,long:3,long:WINDING) dllcall(user32,long:"SetWindowRgn",long:handle,long:hrgn,long:@true) binaryfree(RECT) binaryfree(POINTARR) case 1 ;timer ;move dlg when clicking on it if MouseInfo(8)==4 if MouseInfo(9)==dlgid then dllcall(user32,long:"SendMessageA",long:handle,long:WM_NCLBUTTONDOWN,long:HTCAPTION,lpnull) endif case 2 ;buttons select id case 1 ;hide dllcall(user32,long:"CloseWindow",long:handle) return -2 endselect endselect return -1 #endsubroutine MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`WIL Dialog 1` MyDialogX=-1 MyDialogY=-1 MyDialogWidth=142 MyDialogHeight=136 MyDialogNumControls=002 MyDialogProcedure=`dlgproc` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,255|255|0` MyDialogConfig=4513660 MyDialog001=`017,103,036,012,PUSHBUTTON,DEFAULT,"Hide",1,1,32,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`083,103,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog",1)
Replace:
hrgn=dllcall(gdi32,long:"CreateRoundRectRgn",long:0,long:0,long:binarypeek4(RECT,8),long:binarypeek4(RECT,12),long:100,long:100)with:
hrgn=dllcall(gdi32,long:"CreateEllipticRgn",long:0,long:0,long:binarypeek4(RECT,8),long:binarypeek4(RECT,12))
Article ID: W15473
File Created: 2003:05:13:11:28:06
Last Updated: 2003:05:13:11:28:06