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. MoveWindow()

MoveWindow()

Scheduled Pinned Locked Moved C / C++ / MFC
c++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.
  • O Offline
    O Offline
    Oliver123
    wrote on last edited by
    #1

    I want to change the position and size of a window. In the constructor of the Doc window of a VC++ SDI I have the following code. (I'd also like to do this in any window I make.) CSDITESTfDoc::CSDITESTfDoc() { MoveWindow(5,5,500,500,TRUE); } The compiler says MoveWindow does not take 5 paramaters. The format of the command is: void MoveWindow(int x, int y, int nWidth, int nHeght, BOOL bRepaint = TRUE) Where am I going wrong? Thanks.

    B H D 3 Replies Last reply
    0
    • O Oliver123

      I want to change the position and size of a window. In the constructor of the Doc window of a VC++ SDI I have the following code. (I'd also like to do this in any window I make.) CSDITESTfDoc::CSDITESTfDoc() { MoveWindow(5,5,500,500,TRUE); } The compiler says MoveWindow does not take 5 paramaters. The format of the command is: void MoveWindow(int x, int y, int nWidth, int nHeght, BOOL bRepaint = TRUE) Where am I going wrong? Thanks.

      B Offline
      B Offline
      bob16972
      wrote on last edited by
      #2

      Your doc class does not derive from CWnd so the system will try to use the MoveWindow from the Win32 API... BOOL MoveWindow( HWND hWnd, // handle to window int X, // horizontal position int Y, // vertical position int nWidth, // width int nHeight, // height BOOL bRepaint // repaint flag ); Your view class does derive from CWnd so try that tactic but from within the view class or use a reference or pointer to a view object.

      1 Reply Last reply
      0
      • O Oliver123

        I want to change the position and size of a window. In the constructor of the Doc window of a VC++ SDI I have the following code. (I'd also like to do this in any window I make.) CSDITESTfDoc::CSDITESTfDoc() { MoveWindow(5,5,500,500,TRUE); } The compiler says MoveWindow does not take 5 paramaters. The format of the command is: void MoveWindow(int x, int y, int nWidth, int nHeght, BOOL bRepaint = TRUE) Where am I going wrong? Thanks.

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        First parameter is handle to a window(HWND).

        1 Reply Last reply
        0
        • O Oliver123

          I want to change the position and size of a window. In the constructor of the Doc window of a VC++ SDI I have the following code. (I'd also like to do this in any window I make.) CSDITESTfDoc::CSDITESTfDoc() { MoveWindow(5,5,500,500,TRUE); } The compiler says MoveWindow does not take 5 paramaters. The format of the command is: void MoveWindow(int x, int y, int nWidth, int nHeght, BOOL bRepaint = TRUE) Where am I going wrong? Thanks.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Move your window from the main frame, not the document.

          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          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