Re: ActiveX event and DoModal
On 8 dec, 23:39, RAN <nijenh...@wish.nl> wrote:
On 8 dec, 23:13, "Drew" <d...@dam.com> wrote:
// XP TESTDlg.h : header file
//
#pragma once
#include "chessactivectrl1.h"
#include "PromotionDlg.h"
#define _UDM_TEST WM_USER + 100
// CXPTESTDlg dialog
class CXPTESTDlg : public CDialog
{
// Construction
public:
CXPTESTDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_XPTEST_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CChessactivectrl1 o_ChessActive;
DECLARE_EVENTSINK_MAP()
void OnPromotion();
CPromotionDlg o_PromotionDlg;
afx_msg void OnBnClickedButton1();
LRESULT OnTest(WPARAM wParam, LPARAM lParam);
};
4) if i click the break button after the debug assertion failed box it
jumps to file:
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dlgcore.cpp (line =
492)
HWND CDialog::PreModal()
{
// cannot call DoModal on a dialog already constructed as modeless
ASSERT(m_hWnd == NULL);
// allow OLE servers to disable themselves
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(FALSE);
// find parent HWND
HWND hWnd = CWnd::GetSafeOwner_(m_pParentWnd->GetSafeHwnd(),
&m_hWndTop);
// hook for creation of dialog
AfxHookWindowCreate(this);
// return window to use as parent for dialog
return hWnd;
}
the first ASSERT() failes.
5) i also tried :
void CXPTESTDlg::OnPromotion()
{
// TODO: Add your message handler code here
CDialog o_Test;
o_Test.Create (IDD_PROMOTION);
// This call causes a debug assertion failed
o_Test.DoModal();
}
Why isn't this:
void CXPTESTDlg::OnPromotion()
{
o_PromotionDlg.DoModal();
}
?
Drew
HWND CDialog::PreModal()
{
// cannot call DoModal on a dialog already constructed as modeless
ASSERT(m_hWnd == NULL);
I dont understand the comment. which dialog ? modeless ?- Tekst uit oorsp=
ronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -
The first thing i tried using a local was wrong because i used Create
(), but below also does noet work because i can not move or close the
dialog shown after DoModal()
void CXPTESTDlg::OnPromotion()
{
// TODO: Add your message handler code here
// This call causes a debug assertion failed
//CPromotionDlg o_Test(this);
//o_Test.DoModal ();
//PostMessage(_UDM_TEST);
CPromotionDlg o_Test;
o_Test.DoModal ();
}