大侠们:我想把原先的弹出的对话框内嵌到CWnd中,这样就可以不弹出对话框,效果看起来是直接在CWnd中显示的,请问用什么方法可以做到,二者创建是如何联系的,万分感谢,感谢!!
解决方案 »
- xp系统下使用ExitWindowsEx能够注销、重启,但就是关不了机?
- 除了GIMP有没有谁见过比较完整的读取PSD格式文件的源码呢?
- 一个难题,如何根据句柄获取窗体的额外字节cbWndExtra???
- 征:sdk经典入门书
- 按一定时间间隔显示某一目录下的图片,是用SetTimer么
- DLL中的非模式对话框,在什么时候会出现用IsWindow判断返回False的情况.(内详)
- 谁能给我介绍一下FTP的编程或者给个例子! 非常 非常感谢
- 我翻译的关于窗口类的一点知识 分享吧
- 如何将单帧图像压缩成MPEG4数据流,有源代码?(给200分)
- 如何得到这个字符串中两个()之间的字符串
- 界面基本问题
- 头文件怎么重新定向到另外的路径?
然后通过create创建。
CDialog* pDlg = new CDialog();
pDlg->Create(IDD,this);
pDlg->MoveWindow(...);
CDialog* pDlg = new CDialog();
pDlg->Create(IDD,this);
pDlg->MoveWindow(...);谢谢!!大哥
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
InitGlobalVar(pGlo); CWnd *pParent = (CWnd *)(UINT)(*pLocal)["DEVICETAB"].AsInt();
CLineOnSamePoleDlg *dlg = new CLineOnSamePoleDlg;
CRect rect;
pParent->GetClientRect(&rect);
dlg->Create(IDD_DLGLINEONSAMEPOLE);
// dlg->AddEquipList(EquipCodeList, ChangeNumList);
DWORD style = dlg->GetStyle();
dlg->ModifyStyle(style,WS_CHILD|WS_VISIBLE,1);
dlg->SetParent(pParent);
dlg->MoveWindow(&rect);
dlg->Invalidate(true);
pLocal->At("LocalWindow").SetInt((UINT)dlg);
// CLineOnSamePoleDlg lineOnSamePoleDlg;
// lineOnSamePoleDlg.DoModal(); return true;
}
///////////////////////////////////////
// ChildView.h
//
//////////////////////////////////////
class CChildView : public CWnd
{
// Construction
public:
CChildView();// Attributespublic:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChildView)
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL// Implementation
public:
void ViewBase();
virtual ~CChildView();protected:
InfoDialog* info_dlg; // 申明要嵌进去的对话框Dialog
// Generated message map functions
protected:
//{{AFX_MSG(CChildView)
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif ///////////////////////////////////////////////////////////////
// CChildView.cpp
//
////////////////////////////////////////////////////////////
#include "MainFrm.h"
#include "InfoDialog.h"
.......CChildView::CChildView()
{
info_dlg = NULL;
}CChildView::~CChildView()
{
}
BEGIN_MESSAGE_MAP(CChildView,CWnd )
//{{AFX_MSG_MAP(CChildView)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildView message handlersBOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CWnd::PreCreateWindow(cs))
return FALSE; cs.dwExStyle |= WS_EX_CLIENTEDGE;
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOW+1), NULL); return TRUE;
}void CChildView::OnPaint()
{
CPaintDC dc(this);
CMainFrame *pFrame = (CMainFrame *)AfxGetApp()->m_pMainWnd;
dc.TextOut(1, 1, pFrame->GetInfo());
}
//****************************************
//别的方法调用ViewBase() 即产生窗口放在CWnd中
//***************************************
void CChildView::ViewBase()
{
if (info_dlg != NULL)
info_dlg->SetFocus();
else {
CRect rc;
info_dlg = new InfoDialog;
info_dlg->Create (IDD_PROPPAGE_MEDIUM,this);
info_dlg->ShowWindow (SW_SHOW);
GetClientRect(&rc);
info_dlg->MoveWindow(&rc);
info_dlg->DoModal();
delete info_dlg;
}
}有点问题 望大哥们指点,跪谢 跪谢!!!!
{
if (info_dlg != NULL)
info_dlg->SetFocus();
else {
CRect rc;info_dlg = new InfoDialog;info_dlg->Create (IDD_PROPPAGE_MEDIUM,this);
info_dlg->ShowWindow (SW_SHOW);
//--------------------
DWORD style = dlg->GetStyle();//这一句和下面一句是去除模态,否则有点问题
dlg->ModifyStyle(style,WS_CHILD|WS_VISIBLE,1);
dlg->SetParent(pParent);//这一句最好加上
//----------------------------
GetClientRect(&rc);
info_dlg->MoveWindow(&rc);
info_dlg->DoModal();
delete info_dlg;
}这样应该就OK了,你再试试