I want to use Setwindowpos() in global function to change the postiion of one dialog. So i coded like below
CWnd *pWnd = (CWnd*)pMain->GetDlgItem(IDD_TOOLBAR_DIALOG);//GetActiveFrame ();
pWnd->SetWindowPos(&CWnd::wndBottom,0,80,45,900,SWP_SHOWWINDOW);
pWnd returns as undefined value. So i follow this method
CToolTab * tab;
tab = new CToolTab();
if(tab->GetSafeHwnd() == 0)
{
tab = new CToolTab();
if( tab->m_hWnd != NULL )
{
tab->SetWindowPos(&CWnd::wndBottom,0,80,45,900,SWP_SHOWWINDOW); }
}
But m_hWnd returns 0x0000.So in both cases SetWindowPos shows assertion error. How can i get the handle of dialog in Global function?