Announcement

Collapse
No announcement yet.

Immovable dialog without %WS_SYSMENU ?

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

  • Immovable dialog without %WS_SYSMENU ?

    Given: DIALOG NEW 0, "Caption", x, y, xx, yy TO ghDlg

    Can anyone tell me how to make the dialog *immovable* without using %WS_SYSMENU (which messes up the looks and reduces the caption space by showing the grayed-out "X" box in the upper-right corner)?

    TIA.

  • #2
    William --
    I found my old training code. Sure, that hear are used Lance's ideas.
    Code:
    #Compile Exe
    #Dim All
    #Register None
    #Include "win32api.INC"
    
    Global oldproc As Long
    CallBack Function DlgProc
        Select Case CbMsg
          Case %WM_COMMAND: If CbCtl = %IDOK Then Dialog End CbHndl
          Case %WM_DESTROY: SetWindowLong CbHndl, %GWL_WNDPROC, oldproc
       End Select
    End Function
    
    CallBack Function SubClass
        Select Case CbMsg
         Case %WM_NCHITTEST
            Local SResult As Long
            SResult = CallWindowProc(oldproc, CbHndl, CbMsg, CbWparam, CbLparam)
            If SResult = %HTCAPTION Then SResult = %HTNOWHERE
            Function = SResult: Exit Function
       End Select
       Function = CallWindowProc(oldproc, CbHndl, CbMsg, CbWparam, CbLparam)
    End Function
    
    Function PbMain
       Local hDlg As Long
       Dialog New 0, "Ltr32", , , 100, 200 To hDlg
       Control Add Button, hDlg, %IDOK, "&Quit", 30, 90, 40, 14
       OldProc = SetWindowLong(hDlg, %GWL_WNDPROC, CodePtr(subclass))
       Dialog Show Modal hDlg, Call DlgProc
    
    End Function
    [This message has been edited by Semen Matusovski (edited April 24, 2000).]

    Comment


    • #3
      Thanks for your response Semen!
      One problem - it still moves via the caption bar!
      Maybe you didn't notice the "IM" before moveable?! It means "not" able to be moved.

      I'm looking for a way to *not* allow the user to move the dialog.

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

      Comment


      • #4
        William --
        The same approach
        If SResult = %HTCAPTION Then SResult = %HTNOWHERE
        (code above is corrected now)

        [This message has been edited by Semen Matusovski (edited April 24, 2000).]

        Comment


        • #5
          That does it!

          Thanks Semen!


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

          Comment

          Working...
          X