Announcement

Collapse
No announcement yet.

Dialog with close, without sysmenu..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Brad D Byrne
    replied
    That's strange--- I posted a Thank You Borje---many hours ago
    read it to make sure it was there----it was ----and now its gone???
    Any way---Perfect example, Borje, Thanks B.

    ------------------

    Leave a comment:


  • Borje Hagsten
    replied
    Fellows, thanks for all ideas - and of course, Semen - it works fine. I
    knew I had seen it happen in some code once, but couldn't find it. Also
    know about using a subclassed label and return %HTCAPTION in its
    %WM_NCHITTEST, but wanted easy way out. This was it - thanks a lot!

    Brad, without using resource, classic way is to use LoadImage and bitblt
    it to subclassed control in its WM_ERASEBKGND or WM_PAINT, but can also
    do another way - without subclass, by using %WM_CTLCOLORSTATIC.
    (tested Semens excellent tips in this one too - neat..
    Code:
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    ' BITMAPS - TEMPLATE
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    #COMPILE EXE
    #INCLUDE "WIN32API.INC"
    DECLARE CALLBACK FUNCTION DlgProc() AS LONG
    %ID_LBLBMP = 20
     
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    ' MAIN ENTRANCE - CREATE DIALOG
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    FUNCTION PBMAIN () AS LONG
      LOCAL hDlg AS LONG
     
      DIALOG NEW 0, "Bitmap Template",,, 240, 120, _
             %WS_CAPTION Or %WS_POPUP Or %WS_SYSMENU Or %DS_MODALFRAME TO hDlg
     
      CONTROL ADD LABEL, hDlg, %ID_LBLBMP, "",  0, 0, 120, 120, %SS_SUNKEN
      
      DIALOG SHOW MODAL hDlg CALL DlgProc
     
    END FUNCTION
     
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    ' MAIN DIALOG'S CALLBACK PROCEDURE
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    CALLBACK FUNCTION DlgProc() AS LONG
      SELECT CASE CBMSG
         CASE %WM_INITDIALOG
            STATIC hBmp AS LONG
            LOCAL hBmpDC AS LONG, rc AS RECT, bm AS BITMAP, zBmpFile AS ASCIIZ * %MAX_PATH
     
            GetWindowsDirectory zBmpFile, %MAX_PATH 'test with start-up logo
            zBmpFile = zBmpFile + "\logow.sys"      'whatever bmp file we want to show..
            IF LEN(DIR$(zBmpFile)) THEN
               hBmp = LoadImage(0, zBmpFile, %IMAGE_BITMAP, 0, 0, %LR_LOADFROMFILE)
            END IF
     
         CASE %WM_CTLCOLORSTATIC 'if correct label and we have a bitmap handle
            IF CBLPARAM = GetDlgItem(CBHNDL, %ID_LBLBMP) AND hBmp THEN
               GetClientRect CBLPARAM, rc               'label's size
               GetObject hBmp, SIZEOF(bm), bm           'get bitmap's size
     
               hBmpDC = CreateCompatibleDC(CBWPARAM)    'create DC for bitmap
               SelectObject hBmpDC, hBmp                'select bitmap into DC, then paint it to label's dc
     
               StretchBlt CBWPARAM, 0, 0, rc.nRight, rc.nBottom, _
                            hBmpDC, 0, 0, bm.bmWidth, bm.bmHeight, %SRCCOPY  'stretched to control
     
              'BitBlt CBWPARAM, 0, 0, bm.bmWidth, bm.bmHeight, _
              '         hBmpDC, 0, 0, %SRCCOPY                               'if without stretch..
     
               DeleteDC hBmpDC                          'clean up temporary DC
               FUNCTION = GetStockObject(%HOLLOW_BRUSH) 'return a hollow brush
            END IF
     
         CASE %WM_DESTROY
            IF hBmp THEN DeleteObject hBmp             'clean-up time
     
         CASE %WM_COMMAND                              'NOTE: don't actually need a button, because
           IF CBCTL = %IDCANCEL THEN DIALOG END CBHNDL '      Windows sends %IDCANCEL also on Esc..
     
      END SELECT
     
    END FUNCTION

    ------------------

    Leave a comment:


  • Brad D Byrne
    replied
    Hey Semen,
    Since your on-line, Can we embed a bitmap in/to a control and
    have it retain the painting properties as if it were part of
    the control? thanks---B

    ------------------
    Let me add----witout using a resource file?


    [This message has been edited by Brad D Byrne (edited September 30, 2001).]

    Leave a comment:


  • Brad D Byrne
    replied
    Work's in 98

    Semen Do You Know Everything ????

    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    If w/o icon -
    %WS_CAPTION Or %WS_POPUP Or %WS_SYSMENU Or %DS_MODALFRAME
    (this is so for Win2000 and guess for 98 also)

    BTW, if it's necessary to prevent drop-down (in left part) - NCHITTEST works fine for these purposes.
    Tested in Win2000 only
    Code:
       #Compile Exe
       #Dim All
       #Register None
       #Include "WIN32API.INC"
    
       Global DlgProcOr As Long
    
       CallBack Function SC_DlgProc
          Select Case CbMsg
             Case %WM_NCHITTEST
                  
                Dim i As Long
                i = CallWindowProc(DlgProcOr, CbHndl, CbMsg, CbWparam, CbLparam)
                If i = %HTCAPTION Then _
                  If (GetAsyncKeyState(%VK_RBUTTON) And &H8000) Then i = %HTNOWHERE
                Function = i: Exit Function
          End Select
          Function = CallWindowProc(DlgProcOr, CbHndl, CbMsg, CbWparam, CbLparam)
       End Function
       
       Function PbMain
          Dim hDlg As Long
          Dialog New 0, "Test", , , 100, 100, %WS_CAPTION Or %WS_POPUP Or %WS_SYSMENU Or %DS_MODALFRAME To hDlg
          DlgProcOr = SetWindowLong (hDlg, %GWL_WNDPROC, CodePtr(SC_DlgProc))
          Dialog Show Modal hDlg
      End Function
    [This message has been edited by Semen Matusovski (edited September 30, 2001).]

    Leave a comment:


  • Brad D Byrne
    replied
    It doesn't work in 98---
    Borje wants a Close button without an Icon or a
    drop down SysMenu---as I understand ---B

    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    %WS_CAPTION Or %WS_POPUP Or %WS_SYSMENU

    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Brad D Byrne
    replied
    Further, following Steve's procedure, allows us to easily
    and rapidly drag a rectangle, stopping it when it hits
    another----- (instead of overlapping like windows does)
    Critical for CAD systems-----Also-- the Region functions
    seem overly complex, and I think there are better ways---


    ------------------

    Leave a comment:


  • Steve Hutchesson
    replied
    Borje,

    Something that is no big deal to do is fully control the title
    bar instead of being limited to windows designs. All you need to
    do is place a rectangle the size you want for you title bar at
    the location you want and then trap the WM_MOUSEMOVE message with
    SetCapture at the same coordinates as the displayed rectangle and
    you can do anything you like with title bars. I developed the idea
    for child windows but its only the difference of coordinates for
    a free standing window.

    It allows you to do some non standard things like side titlebars,
    title bars in technicolor, text wherever you want and buttons at
    any location without restriction.

    Regards,

    [email protected]

    ------------------

    Leave a comment:


  • Brad D Byrne
    replied
    Borje,
    I know I'm new to this windows stuff, but I wrestled with this
    myself recently----I have all the SDK manuals(1992) and there
    is no reference to any lone "Close" style anywhere----I played
    with using a label for the bar and blitting a close button on it
    --it seemed like to much work---so now I just put a button on my
    main window/dialog for each modeless sub-dialog, to; 1)show status
    & 2)open and close the sub-dialogs as needed.

    Borje, I know you already have thought of all this, but I wish
    to bonce my opinions of all this off of you---for your comments
    have saved me a lot of time in the past. I am starting to believe
    that much of windows was written by many different programmers,
    who were not communicating with each-other, for there are many
    things that seem not to work together------I hate to say it ---
    but there is a lot windows that I think is awful good---such as
    the font,text editor,clipboard,printer support...etc. And there's
    a lot that seems awful bad!!! I am coming to the conclusion that
    for Me--- My best approach is to use only certain windows elements
    and write my own code for the rest-----I do believe that windows
    as a whole has so many quirks and exceptions in it ---that if we
    were to master all of the functions ----we would never get to
    the end----So for speed I think we should write our own PB/WinAPI
    I don't know ---do you think I'm getting lazy???----B

    ------------------

    Leave a comment:


  • Borje Hagsten
    started a topic Dialog with close, without sysmenu..

    Dialog with close, without sysmenu..

    Just wondering. Is there an easy way to create a normal dialog with caption and just
    a close button, without the sysmenu/icon on the left side? Like an Open File dialog?

    Can only get close button in caption with %WS_SYSMENU here. Then must do a stunt
    and remove the menu by brutal force. Have tried to find some combination in styles
    that simply creates a normal dialog with close button (x) and no menu, without luck.
    Must be missing something obvious, or maybe one has to use GetSystemMenu to get its
    handle and then remove it after all?

    But then, another problem: If to destroy the meny, the caption bar becomes dead and
    the close button grayed. If to remove items, I still have to leave one, the close
    item (Alt+F4), otherwise same result. I'm actually completely lost on this one..


    ------------------
Working...
X