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. Move Window

Move Window

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 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.
  • M Offline
    M Offline
    mehrdadov
    wrote on last edited by
    #1

    Hello I want to Create a modaless dialog that user can't move it how can i do it? thanks. Agh

    Y PJ ArendsP T 3 Replies Last reply
    0
    • M mehrdadov

      Hello I want to Create a modaless dialog that user can't move it how can i do it? thanks. Agh

      Y Offline
      Y Offline
      YaronNir
      wrote on last edited by
      #2

      when you drag the dialog a message is called i.e : SendMessage(WM_NCLBUTTONDOWN, HTCAPTION) just override this message not to do its defaults... hope this helps Ask not what your application can do for you, Ask what you can do for your application

      1 Reply Last reply
      0
      • M mehrdadov

        Hello I want to Create a modaless dialog that user can't move it how can i do it? thanks. Agh

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

        Add a CRect member to your dialog class and handle the WM_MOVE and WM_MOVING messages. In the WM_MOVE message handler call GetWindowRect() to get the position of the dialog, save it in the CRect member. In the WM_MOVING handler, set the values of the supplied CRect pointer to those in the saved CRect.

        void CMyDialog::OnMove(int x, int y)
        {
        CDialog::OnMove(x, y);
        GetWindowRect(m_Rect);
        }

        void CMyDialog::OnMoving(UINT fwSide, LPRECT pRect)
        {
        *pRect = m_Rect;
        }

        The method given above will only work if the user tries to move the dialog with the mouse, it will break when the user uses the Move command in the context menu.


        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!

        1 Reply Last reply
        0
        • M mehrdadov

          Hello I want to Create a modaless dialog that user can't move it how can i do it? thanks. Agh

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          mehrdadov wrote:

          I want to Create a modaless dialog that user can't move it

          Simply remove it caption bar!

          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