通常需要:1,设置窗口的父子关系;2,确定弹出窗口的初始显示位置;
void CMainFrame::OnDoSomething() { WndWpf^ wnd = gcnew WndWpf(); WindowInteropHelper^ wndHelper = gcnew WindowInteropHelper(wnd); IntPtr ptr(this->GetSafeHwnd()); wndHelper->Owner = ptr; // move the window to (left, top) of client area CRect rc; this->GetClientRect(&rc); this->ClientToScreen(&rc); wnd->Left = rc.left; wnd->Top = rc.top; wnd->Show(); }
-