CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Fnding active window

    Hi,
    I want to create a Program, which finds active windows.

    I'm using MFC.

    thanks for your help!1

    Black racer


  2. #2
    Join Date
    Aug 1999
    Posts
    427

    Re: Fnding active window

    If your mean active View window than by this way you may rich you active View window from anywhere.
    1. In your View class create static function GetView()
    2 Implement it like this

    CMyView* CMyView::GetView()
    {
    CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
    CView * pView = pFrame->GetActiveView();
    if ( !pView )
    return NULL;
    if ( ! pView->IsKindOf( RUNTIME_CLASS(CMyView) ) )
    return NULL;
    return (CMyView *) pView;
    }



    Since it static function you my call it from everywhere like this
    CMyViev::GetView();
    If you mean Main Window use
    AfxGetMainWnd()

    Hope it help


  3. #3
    Join Date
    Jun 1999
    Location
    Canada - Québec
    Posts
    273

    Re: Fnding active window

    try :
    GetActiveWindow();


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured