Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WM_NCHITTEST and borders

WM_NCHITTEST and borders

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Axonn Echysttas
    wrote on last edited by
    #1

    Heya everybody. I got a question about WM_NCHITTEST... I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position. -= E C H Y S T T A S =- The Greater Mind Balance

    I PJ ArendsP N 3 Replies Last reply
    0
    • A Axonn Echysttas

      Heya everybody. I got a question about WM_NCHITTEST... I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position. -= E C H Y S T T A S =- The Greater Mind Balance

      I Offline
      I Offline
      includeh10
      wrote on last edited by
      #2

      I did a test for you, add the 3 lines: //=============================== CMenu*pMu=GetSystemMenu(0); pMu->RemoveMenu(SC_SIZE,MF_BYCOMMAND); ModifyStyle(WS_MAXIMIZEBOX,0); //=============================== the window will not be sized.


      A nice tool for optimizing your Microsoft html-help contents. Includeh10

      A 1 Reply Last reply
      0
      • A Axonn Echysttas

        Heya everybody. I got a question about WM_NCHITTEST... I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position. -= E C H Y S T T A S =- The Greater Mind Balance

        PJ ArendsP Offline
        PJ ArendsP Offline
        PJ Arends
        wrote on last edited by
        #3

        Use the return value of the base class OnNcHitTest. MFC

        UINT CMyWnd::OnNcHitTest(CPoint point)
        {
        UINT border = CWnd::OnNcHitTest(point);
        switch (border)
        {
        case HT_BOTTOM:
        border = HTBORDER;
        break;
        ...
        }

        return border;
        }

        Win32

        LRESULT CALLBACK WndProc (...)
        {
        switch (nMsg)
        {
        case WM_NCHITEST:
        {
        UINT border = ::DefWindowProc(hWnd, nMsg, wp, lp);
        switch (border)
        ...

        Well, you get the idea


        You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

        Within you lies the power for good; Use it!

        A 1 Reply Last reply
        0
        • A Axonn Echysttas

          Heya everybody. I got a question about WM_NCHITTEST... I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position. -= E C H Y S T T A S =- The Greater Mind Balance

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          WM_NCMOUSEMOVE


          Nibu thomas Software Developer

          1 Reply Last reply
          0
          • I includeh10

            I did a test for you, add the 3 lines: //=============================== CMenu*pMu=GetSystemMenu(0); pMu->RemoveMenu(SC_SIZE,MF_BYCOMMAND); ModifyStyle(WS_MAXIMIZEBOX,0); //=============================== the window will not be sized.


            A nice tool for optimizing your Microsoft html-help contents. Includeh10

            A Offline
            A Offline
            Axonn Echysttas
            wrote on last edited by
            #5

            Thank you. I don't know if this would work on WIN32 though, since I am not using MFC. -= E C H Y S T T A S =- The Greater Mind Balance

            1 Reply Last reply
            0
            • PJ ArendsP PJ Arends

              Use the return value of the base class OnNcHitTest. MFC

              UINT CMyWnd::OnNcHitTest(CPoint point)
              {
              UINT border = CWnd::OnNcHitTest(point);
              switch (border)
              {
              case HT_BOTTOM:
              border = HTBORDER;
              break;
              ...
              }

              return border;
              }

              Win32

              LRESULT CALLBACK WndProc (...)
              {
              switch (nMsg)
              {
              case WM_NCHITEST:
              {
              UINT border = ::DefWindowProc(hWnd, nMsg, wp, lp);
              switch (border)
              ...

              Well, you get the idea


              You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

              A Offline
              A Offline
              Axonn Echysttas
              wrote on last edited by
              #6

              Yeap, I got it. I should have thought at the DefWindowProc stuff. Hrmph *pissed off on self*. Thank you. -= E C H Y S T T A S =- The Greater Mind Balance

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups