Hi,
I want to create a Program, which finds active windows.
I'm using MFC.
thanks for your help!1
Black racer
Printable View
Hi,
I want to create a Program, which finds active windows.
I'm using MFC.
thanks for your help!1
Black racer
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
try :
GetActiveWindow();