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. Maximizing app at startup - how?

Maximizing app at startup - how?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialcsharpvisual-studioquestion
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Can someone please enlighten me about how to maximize the app's mainframe at startup? I have tried calling ShowWindow() from the InitInstance() and that doesn't do it. I've looked through the MS docs in the Visual Studio 6 and not come accross anything relevant (like a code snippet, for example!) Some pointers would be greatly appreciated! One person suggested setting the style to WS_MAXIMIZE in PreCreateWindow() but that does not do it.

    R I 2 Replies Last reply
    0
    • L Lost User

      Can someone please enlighten me about how to maximize the app's mainframe at startup? I have tried calling ShowWindow() from the InitInstance() and that doesn't do it. I've looked through the MS docs in the Visual Studio 6 and not come accross anything relevant (like a code snippet, for example!) Some pointers would be greatly appreciated! One person suggested setting the style to WS_MAXIMIZE in PreCreateWindow() but that does not do it.

      R Offline
      R Offline
      Richard Warg
      wrote on last edited by
      #2

      In the CWinApp descendent: // The one and only window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED); m_pMainWnd->UpdateWindow(); SW_SHOWMAXIMIZED does it for you. Also in the Application wizard in step 4 of 6 there's an Advanced Button. Follow that button to the Windows Style Tab and check the Maximized box.

      1 Reply Last reply
      0
      • L Lost User

        Can someone please enlighten me about how to maximize the app's mainframe at startup? I have tried calling ShowWindow() from the InitInstance() and that doesn't do it. I've looked through the MS docs in the Visual Studio 6 and not come accross anything relevant (like a code snippet, for example!) Some pointers would be greatly appreciated! One person suggested setting the style to WS_MAXIMIZE in PreCreateWindow() but that does not do it.

        I Offline
        I Offline
        imsniper
        wrote on last edited by
        #3

        Both of them are correct!! but only if you join both of their answers at InitInstanse there is a variable called p_MainWnd do the following p_MainWnd->ShowWindow(WS_MAXIMISE); a good place to put it is at the end of that function

        U 1 Reply Last reply
        0
        • I imsniper

          Both of them are correct!! but only if you join both of their answers at InitInstanse there is a variable called p_MainWnd do the following p_MainWnd->ShowWindow(WS_MAXIMISE); a good place to put it is at the end of that function

          U Offline
          U Offline
          User 749
          wrote on last edited by
          #4

          You don't want to pass WS_MAXIMIZE, a style code, to ShowWindow. You're supposed to do as Mr. Warg pointed out: Change pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); to pMainFrame->ShowWindow(SW_SHOWMAXIMIZED); pMainFrame->UpdateWindow(); Note the WS_* in front means a *W*indow *S*tyle code, whereas the SW_* in front means a *S*how*W*indow code. AppWizard supplies the pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); code for you; all you have to do is to replace the m_nCmdShow with SW_SHOWMAXIMIZED, and you're in business!! Brian Hart

          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