![]() |
#2
zbjshower2010-05-20 08:43
|
只有本站会员才能查看附件,请 登录
程序如下:
// TODO: Add your control notification handler code here
char wnd_name[]="MyTest";
mwArray mwWndName(wnd_name);
mccdemo3(mwWndName); //调用演示函数
//获得窗口句柄
HWND hFig=::FindWindow(NULL,wnd_name);
while(hFig==NULL)
{
hFig=::FindWindow(NULL,wnd_name);
}
//首先隐藏窗口
::ShowWindow(hFig,SW_HIDE);
//获得空间区域
CRect figure_rect;
CWnd *myfigure=GetDlgItem(IDC_STATIC);
myfigure->GetWindowRect(&figure_rect);
long fig_width=figure_rect.Width();
long fig_height=figure_rect.Height();
//重置MATLAB Figure窗口的父窗口
::SetParent(hFig,myfigure->GetSafeHwnd());
//去掉MATLAB Figure窗口的标题栏和框架属性
long lStyle=::GetWindowLong(hFig,GWL_STYLE);
::SetWindowLong(hFig,GWL_STYLE,lStyle&(~WS_CAPTION)&(~WS_THICKFRAME));
//::ShowWindow(hFig,SW_SHOW);
//将MATLAB Figure窗口移动到空间位置
::SetWindowPos(hFig,HWND_BOTTOM,0,0,fig_width+8,fig_height+33,SWP_NOZORDER|SWP_NOACTIVATE);
//显示窗口
::ShowWindow(hFig,SW_SHOW);
//激活主窗口
::SetForegroundWindow(this->m_hWnd);