d***@gmail.com
2014-07-03 07:40:28 UTC
Good day!
I'm new with MFC.. I have trouble on making dialog "CS_NOCLOSE" in visual studio 2010. Here is the snippet on how I create the these dialog.
///////////////////////////////////////
class CToolDlg : public CDialog
{
public:
CEditDlg1 m_dlg1;
CEditDlg2 m_dlg2;
void Create(CWnd *pParent) // the Parent is mainframe
{
CString str = AfxRegisterWndClass(CS_NOCLOSE,NULL, NULL, NULL);
CRect rect;
pPrent->GetWindowRect(rect);
....
....
CWnd::CreteEx(WS_EX_TOOLWINDOW, str, _("XXX"), WS_POPUP|WS_BORDER|WS_CAPTION, rect, pParent, NULL);
m_dlg1.Create();
m_dlg2.Create();
SetToolDlg(&m_dlg1);
ShowWindow(SW_SHOW);
}
void SetToolDlg(CDlg * pWnd)
{
CRect rect(0, 0, 0, 0);
if (pWnd)
pWnd->GetWindowRect(rect);
else
m_dlg1.GetWindowRect(rect);
CalcWindowRect(rect, 0);
SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_NOACTIVTE|SWP_NOZORDER|SWP_NOMOVE);
if (pWnd)
{
pWnd->GetParent()->SetWindowTextW(_T("Test"));
pWnd->ShowWindow(SW_SHOWA);
pWNd->SetWindowPos(&wndTop, 0, 0, 0, 0, SW_NOACTIVATE|SWP_NOZORDER);
}
}
}
///////////////////////////////////////
The problem is when I click the toolbar for every dialog, the dialog will changed the size but the controls for that dialog didn't display.
Then when I click again the same toolbar the dialog size will change and the size is too small.
Is there anyone can help me to solve this problem?
Thanks in advance.
Denniel
ROHM LSI Design Philippines, Inc.
Research and Development - EDA
I'm new with MFC.. I have trouble on making dialog "CS_NOCLOSE" in visual studio 2010. Here is the snippet on how I create the these dialog.
///////////////////////////////////////
class CToolDlg : public CDialog
{
public:
CEditDlg1 m_dlg1;
CEditDlg2 m_dlg2;
void Create(CWnd *pParent) // the Parent is mainframe
{
CString str = AfxRegisterWndClass(CS_NOCLOSE,NULL, NULL, NULL);
CRect rect;
pPrent->GetWindowRect(rect);
....
....
CWnd::CreteEx(WS_EX_TOOLWINDOW, str, _("XXX"), WS_POPUP|WS_BORDER|WS_CAPTION, rect, pParent, NULL);
m_dlg1.Create();
m_dlg2.Create();
SetToolDlg(&m_dlg1);
ShowWindow(SW_SHOW);
}
void SetToolDlg(CDlg * pWnd)
{
CRect rect(0, 0, 0, 0);
if (pWnd)
pWnd->GetWindowRect(rect);
else
m_dlg1.GetWindowRect(rect);
CalcWindowRect(rect, 0);
SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_NOACTIVTE|SWP_NOZORDER|SWP_NOMOVE);
if (pWnd)
{
pWnd->GetParent()->SetWindowTextW(_T("Test"));
pWnd->ShowWindow(SW_SHOWA);
pWNd->SetWindowPos(&wndTop, 0, 0, 0, 0, SW_NOACTIVATE|SWP_NOZORDER);
}
}
}
///////////////////////////////////////
The problem is when I click the toolbar for every dialog, the dialog will changed the size but the controls for that dialog didn't display.
Then when I click again the same toolbar the dialog size will change and the size is too small.
Is there anyone can help me to solve this problem?
Thanks in advance.
Denniel
ROHM LSI Design Philippines, Inc.
Research and Development - EDA