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. Getting hwnd of a child window

Getting hwnd of a child window

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

    Does anyone know how to get a handle to a mdi child window WITHOUT MAKING IT ACTIVE? Take a look at this code: CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIChildWnd *pChild; CMyView *pView; CMyDoc *doc; CString findWindow = "My1";// this is the title of the window i want to find while(TRUE){ pChild = (CMDIChildWnd *)pFrame->GetActiveFrame(); pView = CMyView *) pChild->GetActiveView(); doc = (CMyDoc *) pView->GetDocument(); CString str; str = doc->GetTitle(); //if screen title is the same as node text, return. if(findWindow.Compare(str) == 0) return TRUE; pFrame->MDINext(); } This code works great, it will find the child window that has the same title as the one i pass to it. however, it will make all the open windows active when, method MDINext() will go to next child and will activate that child, i don't want that, i want it to search through all window without activating them. I used LockWindowUpdate on pFrame after calling MDINext() but it did not work, any idea? Thanks, ****Rukhsar

    S 1 Reply Last reply
    0
    • R Rukhsar

      Does anyone know how to get a handle to a mdi child window WITHOUT MAKING IT ACTIVE? Take a look at this code: CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIChildWnd *pChild; CMyView *pView; CMyDoc *doc; CString findWindow = "My1";// this is the title of the window i want to find while(TRUE){ pChild = (CMDIChildWnd *)pFrame->GetActiveFrame(); pView = CMyView *) pChild->GetActiveView(); doc = (CMyDoc *) pView->GetDocument(); CString str; str = doc->GetTitle(); //if screen title is the same as node text, return. if(findWindow.Compare(str) == 0) return TRUE; pFrame->MDINext(); } This code works great, it will find the child window that has the same title as the one i pass to it. however, it will make all the open windows active when, method MDINext() will go to next child and will activate that child, i don't want that, i want it to search through all window without activating them. I used LockWindowUpdate on pFrame after calling MDINext() but it did not work, any idea? Thanks, ****Rukhsar

      S Offline
      S Offline
      Stephen Caldwell
      wrote on last edited by
      #2

      You try using the win32 API function EnumChildWindows(). Stephen Caldwell Desick Information Technologies

      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