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. How can I resize my CFrameWnd

How can I resize my CFrameWnd

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 2 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
    richardye
    wrote on last edited by
    #1

    I try to resize my CFrameWnd, but it doesn't work. Can anyone tell me the reason, thanks void CMyApp::OnAppAbout() { //here I want to resize and draw my framw window SendMessage(AfxGetMainWnd()->m_hWnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(50, 50)); AfxGetMainWnd()->ShowWindow(SW_SHOW); AfxGetMainWnd()->UpdateWindow(); }

    B 1 Reply Last reply
    0
    • R richardye

      I try to resize my CFrameWnd, but it doesn't work. Can anyone tell me the reason, thanks void CMyApp::OnAppAbout() { //here I want to resize and draw my framw window SendMessage(AfxGetMainWnd()->m_hWnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(50, 50)); AfxGetMainWnd()->ShowWindow(SW_SHOW); AfxGetMainWnd()->UpdateWindow(); }

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

      SetWindowPos(AfxGetMainWnd()->m_hWnd,NULL,0,0,50,50,SWP_SHOWWINDOW);

      R 1 Reply Last reply
      0
      • B bob16972

        SetWindowPos(AfxGetMainWnd()->m_hWnd,NULL,0,0,50,50,SWP_SHOWWINDOW);

        R Offline
        R Offline
        richardye
        wrote on last edited by
        #3

        Thank you for your advise. If I call SetWindowPos, it indeed does work. However, I feel very strange about why WM_SIZE message doesn't do any effect. Won't it redraw the frame after I resize it?

        B 1 Reply Last reply
        0
        • R richardye

          Thank you for your advise. If I call SetWindowPos, it indeed does work. However, I feel very strange about why WM_SIZE message doesn't do any effect. Won't it redraw the frame after I resize it?

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

          richardye wrote: However, I feel very strange about why WM_SIZE message doesn't do any effect. From MSDN: "The WM_SIZE message is sent to a window after its size has changed. " Did you mean to call the windows API function MoveWindow() (Or it's MFC wrapper equivalent)? CWnd* pWnd=AfxGetMainWnd(); if (pWnd) { CRect rect; pWnd->GetWindowRect(&rect); rect.right=rect.left+50; rect.bottom=rect.top+50; pWnd->MoveWindow(rect); }

          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