Folks,
Is it possible to build a DDT Dialog without the Title Bar?
Thanks, B
------------------
Is it possible to build a DDT Dialog without the Title Bar?
Thanks, B
------------------
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Dialog with own caption bar '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ #COMPILE EXE #INCLUDE "WIN32API.INC" %ID_CAPTIONBAR = 20 GLOBAL ghCaptionBar AS LONG, oldBarProc AS LONG GLOBAL flag AS LONG 'global flag for active/inactive status DECLARE CALLBACK FUNCTION DlgProcedure() DECLARE CALLBACK FUNCTION BarProc() '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' MAIN ENTRANCE '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ FUNCTION PBMAIN LOCAL hDlg AS LONG DIALOG NEW 0, "MyProg",,, 240, 150, %WS_POPUP OR %WS_DLGFRAME TO hDlg ' remove %WS_DLGFRAME style to create flat dialog.. CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Close", 183, 130, 50, 14 CONTROL ADD LABEL, hDlg, %ID_CAPTIONBAR, "", 0, 0, 240, 16, %SS_NOTIFY CONTROL HANDLE hDlg, %ID_CAPTIONBAR TO ghCaptionBar 'sub-class captionbar label and let BarProc handle it oldBarProc = SetWindowLong(ghCaptionBar, %GWL_WNDPROC, CODEPTR(BarProc)) DIALOG SHOW MODAL hDlg CALL DlgProcedure END FUNCTION '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' MAIN DIALOG PROCEDURE '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ CALLBACK FUNCTION DlgProcedure() SELECT CASE CBMSG CASE %WM_COMMAND SELECT CASE CBCTL CASE %IDCANCEL : DIALOG END CBHNDL END SELECT CASE %WM_NCACTIVATE 'active/inactive status recorded here flag = CBWPARAM InvalidateRect ghCaptionBar, BYVAL %NULL, 0 'need to repaint captionbar UpdateWindow ghCaptionBar CASE %WM_CTLCOLORSTATIC 'captionbar asks for colors IF CBLPARAM = ghCaptionBar THEN SetBkMode CBWPARAM, %TRANSPARENT IF flag THEN SetTextColor CBWPARAM, GetSysColor(%COLOR_CAPTIONTEXT) FUNCTION = GetSysColorBrush(%COLOR_ACTIVECAPTION) ELSE SetTextColor CBWPARAM, GetSysColor(%COLOR_INACTIVECAPTIONTEXT) FUNCTION = GetSysColorBrush(%COLOR_INACTIVECAPTION) END IF END IF CASE %WM_DESTROY IF oldBarProc THEN 'un-subclass captionbar label at exit SetWindowLong ghCaptionBar, %GWL_WNDPROC, oldBarProc END IF END SELECT END FUNCTION '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' SUB-CLASSED CAPTIONBAR LABEL PROCEDURE ' Here all painting of captionbar is done, plus handling of eventual dragging ' with the mouse. Can be expanded to whatever, like BitBlt'ing a bitmap as ' background, do more advanced painting, etc. '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ CALLBACK FUNCTION BarProc() SELECT CASE CBMSG CASE %WM_INITDIALOG LOCAL hBrush AS LONG, hImg AS LONG, ps AS PAINTSTRUCT, _ rc AS RECT, zTxt AS ASCIIZ * 260 CASE %WM_LBUTTONDOWN 'do dragging if mouse down on caption bar label SendMessage GetParent(CBHNDL), %WM_NCLBUTTONDOWN, %HTCAPTION, BYVAL %NULL FUNCTION = 0 : EXIT FUNCTION CASE %WM_PAINT GetClientRect CBHNDL, rc 'get control's size BeginPaint CBHNDL, ps 'initiate painting hBrush = SendMessage(GetParent(CBHNDL), _ %WM_CTLCOLORSTATIC, ps.hDC, CBHNDL) 'get brush from parent's %WM_CTLCOLORSTATIC FillRect ps.hDC, rc, hBrush 'paint background hImg = LoadIcon(0, BYVAL %IDI_WINLOGO) 'draw an icon in top-left corner (just to show a way to do it) DrawIconEx ps.hDC, 0, -2, hImg, 0, 0, 0, BYVAL 0, %DI_NORMAL zTxt = "Click here to drag.." 'draw caption text (here centered) DrawText ps.hDC, zTxt, LEN(zTxt), rc, _ %DT_SINGLELINE OR %DT_CENTER OR %DT_VCENTER EndPaint CBHNDL, ps FUNCTION = 0 : EXIT FUNCTION END SELECT FUNCTION = CallWindowProc(oldBarProc, CBHNDL, CBMSG, CBWPARAM, CBLPARAM) END FUNCTION
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment