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. window size

window size

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 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.
  • R Offline
    R Offline
    Rajveer
    wrote on last edited by
    #1

    I have an MDI application. How can I change the default sizes for the child and parent windows when the application starts up?

    M J 2 Replies Last reply
    0
    • R Rajveer

      I have an MDI application. How can I change the default sizes for the child and parent windows when the application starts up?

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      In PreCreateWindow() of these two class: cs.x=yoursize; or cs.cx=yoursize; cs.y=yoursize; or cs.cy=yoursize; I forgot which one is the one you want,test both of them. Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd

      1 Reply Last reply
      0
      • R Rajveer

        I have an MDI application. How can I change the default sizes for the child and parent windows when the application starts up?

        J Offline
        J Offline
        Joel Holdsworth
        wrote on last edited by
        #3

        The solution which initially springs to mind is what you can do with the PreCreateWindow function. As the name suggest, this function is called right before the window is created. The only parameter is a reference to a CREATESTRUCT. Create structs have these parameters... LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCTSTR lpszName; LPCTSTR lpszClass; DWORD dwExStyle; All of these variables are a goldmine of useful settings. Whats interesting about CREATESTRUCT in the context of MDI is that lpCreateParams is a pointer to a MDICREATESTRUCT. This has these members... LPCTSTR szClass; LPCTSTR szTitle; HANDLE hOwner; int x; int y; int cx; int cy; DWORD style; LPARAM lParam; with this you can do all sorts of stuff like setting the windows size, and by changing the style parameter you can get the window maximized... e.g. ((MDICREATESTRUCT*)cs.lpCreateParams)->style |= WS_MAXIMIZE; Hope that lots of use! With time we live, with money we spend! Joel Holdsworth

        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