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. SetWindowPos Problem

SetWindowPos Problem

Scheduled Pinned Locked Moved C / C++ / MFC
comhelp
2 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.
  • A Offline
    A Offline
    AJ123
    wrote on last edited by
    #1

    I have positioned an ActiveX control onto a tabsheet control. I now want the ActiveX control to resize with the window. For some reason i don't get the desired result, can nayone see where i am slipping up. Thanks Richard Code Fragment: Init Dialog - Creation of the ActiveX Control m_tabSheet.GetWindowRect( &rc ); ScreenToClient( &rc ); rc.top += 30; rc.bottom -=90; rc.left += 5; rc.right -= 40; m_controlWrapper1.Create(m_hWnd,rc, _T("MSCAL.Calendar"), WS_CHILD, ....) Resize Event ============= RECT tabRC; m_tabSheet.GetClientRect(&tabRC); ScreenToClient( &tabRC ); tabRC.top += 30; tabRC.bottom -=90; tabRC.left += 5; tabRC.right -= 40; m_controlWrapper1.SetWindowPos(CWnd::wndTop, tabRC.left, tabRC.top,tabRC.right - tabRC.left, tabRC.bottom - tabRC.top,SWP_SHOWWINDOW);

    E 1 Reply Last reply
    0
    • A AJ123

      I have positioned an ActiveX control onto a tabsheet control. I now want the ActiveX control to resize with the window. For some reason i don't get the desired result, can nayone see where i am slipping up. Thanks Richard Code Fragment: Init Dialog - Creation of the ActiveX Control m_tabSheet.GetWindowRect( &rc ); ScreenToClient( &rc ); rc.top += 30; rc.bottom -=90; rc.left += 5; rc.right -= 40; m_controlWrapper1.Create(m_hWnd,rc, _T("MSCAL.Calendar"), WS_CHILD, ....) Resize Event ============= RECT tabRC; m_tabSheet.GetClientRect(&tabRC); ScreenToClient( &tabRC ); tabRC.top += 30; tabRC.bottom -=90; tabRC.left += 5; tabRC.right -= 40; m_controlWrapper1.SetWindowPos(CWnd::wndTop, tabRC.left, tabRC.top,tabRC.right - tabRC.left, tabRC.bottom - tabRC.top,SWP_SHOWWINDOW);

      E Offline
      E Offline
      Elrond
      wrote on last edited by
      #2

      One thing is that I think you'd better use the MoveWindow function instead of the SetWindowPos function in that case. Have you checked the the coordinate don't reach something like a bottom higher than a top... Computers have enabled people to make more mistakes faster than almost any invention in history, with the possible exception of tequila and hand guns. - Carl Gundlach

      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