Announcement

Collapse
No announcement yet.

%SC_DEFAULT

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

  • %SC_DEFAULT

    In MSDN I found %SC_DEFAULT (&HF032&) is the message a window gets when the user double-clicks the caption. This message is processed by default (DefFrameProc or DefMDIchildProc) to maximize/restore the window. I want to intercept this message, but it is not delared into the WIN32API.inc file. Of course I can declare this equate on myself.

    The question is: is there anything wrong in using %SC_DEFAULT, since it is missing in the include file? Can I use it and feel easy?

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



    [This message has been edited by Aldo Cavini (edited April 02, 2001).]
    Rgds, Aldo

  • #2
    There are no known problems (at least none that I am aware of). It was probably only omitted by oversight... I'll ask for it to be added to the next update to WIN32API.INC.

    Thanks!


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      aldo --

      to be precise, sc_default is not a message, it is a sub-message of wm_syscommand. and there is one "gotcha" to keep in mind, depending on how you intend to process the wm_syscommand messages...

      http://www.powerbasic.com/support/pb...ad.php?t=22588

      also, are you sure that &hf032& is always generated? if memory serves, &hf032& is generated if the window is in one state, and &hf122& if it's in the other. but i may be remembering wrong...

      -- eric

      ------------------
      perfect sync development tools
      perfect sync web site
      contact us: mailto:[email protected][email protected]</a>



      [this message has been edited by eric pearson (edited april 02, 2001).]
      "Not my circus, not my monkeys."

      Comment


      • #4
        I just ran a quick test and apparently my memory is ok. A double-click on the title bar returns (at least) two different values, so SC_DEFAULT is not a "fixed" value and can't be defined as an equate.

        I guess you could consider the &h0002 "modifier" to be SC_CLOSE. It can be added to either SC_RESTORE or SC_MAXIMIZE to get the values that are returned when you double-click the title bar.

        ------------------
        Perfect Sync Development Tools
        Perfect Sync Web Site
        Contact Us: mailto:[email protected][email protected]</A>
        "Not my circus, not my monkeys."

        Comment


        • #5
          According to the latest WINUSER.H, %SC_DEFAULT = &HF160 ...which is, of course,
          different from the values reported by Aldo and Eric. Color it "Microsoft".
          We'll look into it.

          ------------------
          Tom Hanlin
          PowerBASIC Staff

          Comment


          • #6
            Hmmm... I wonder if maybe you have to subclass the window to see the "real" SC_DEFAULT submessage, and the &h values above are secondary messages that actually perform the maximize/restore operations. I never see &hF160 in my WM_SYCOMMAND handlers.

            -- Eric


            ------------------
            Perfect Sync Development Tools
            Perfect Sync Web Site
            Contact Us: mailto:[email protected][email protected]</A>
            "Not my circus, not my monkeys."

            Comment


            • #7
              Under Win2000 I see %SC_DEFAULT = &HF032&

              Code:
                #Compile Exe
                #Dim All
                #Register None
                #Include "WIN32API.INC"
                
                %SC_DEFAULT = &HF032&
                
                CallBack Function DlgProc
                   If CbMsg = %WM_SYSCOMMAND Then If CbCtl = %SC_DEFAULT Then _
                      MsgBox "Oh", %MB_TASKMODAL: Function = 1
                End Function
                Function PbMain
                   Local hDlg As Long
                   Dialog New 0, "Test", , , 100, 70, %WS_CAPTION Or %WS_SYSMENU Or %WS_MAXIMIZEBOX Or %WS_MINIMIZEBOX Or %WS_THICKFRAME To hDlg
                   Dialog Show Modal hDlg, Call DlgProc
                End Function
              But WS_MAXIMIZEBOX is required.

              [This message has been edited by Semen Matusovski (edited April 02, 2001).]

              Comment


              • #8
                Also to the point, the same code does not trigger an &HF160& ...sure looks like a bug
                in Microsoft's SDK headers. The "Knowledgebase" doesn't mention any such issue. Anyone
                feel like risking $100 on a Microsoft "support incident"? They'll kindly refund your
                money if they agree that it's a bug!


                ------------------
                Tom Hanlin
                PowerBASIC Staff

                Comment


                • #9
                  Eric, of course SC_DEFAULT is not a message... I forgot to declare it in my first post. Very interesting the TWO different messages I can get: it'd be very usefult to have a confirmation one can use that "&h0002 modifier"... Any way I need to intercept both the Maximize button click and the caption double click to modify the standard response to a maximize command. I hope my &HF032 equate will work correctly.

                  Thanks to everybody.

                  ------------------
                  Rgds, Aldo

                  Comment


                  • #10
                    In WM_SYSCOMMAND messages, the four low-order bits of the wParam parameter
                    are used internally by the system. To obtain the correct result when testing
                    the value of wParam, an application must combine the value 0xFFF0 with the
                    wParam value by using the bitwise AND operator.
                    obsolete as Eric already given this info....

                    ------------------
                    Fred
                    mailto:[email protected][email protected]</A>
                    http://www.oxenby.se



                    [This message has been edited by Fred Oxenby (edited April 03, 2001).]
                    Fred
                    mailto:[email protected][email protected]</A>
                    http://www.oxenby.se

                    Comment


                    • #11
                      Fred,

                      it teachs us to read EVERY line of the help files before using any function... If I noticed what you quoted I never posted my question.

                      ------------------
                      Rgds, Aldo

                      Comment

                      Working...
                      X