Re: ActiveX event and DoModal
On 9 dec, 01:55, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
wrote:
"RAN" <nijenh...@wish.nl> wrote in message news:8666f3cf-6ac7-4858-b20e->=
//
cannot call DoModal on a dialog already constructed as modeless
ASSERT(m_hWnd == NULL);
I dont understand the comment. which dialog ? modeless ?- Tekst uit
oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -
The assert means that the dialog you are creating has already been create=
d
elsewhere. It has an m_hWnd. This can be caused by calling the dial=
og
Create function.
// This call causes a debug assertion failed
//CPromotionDlg o_Test(this);
//o_Test.DoModal ();
This is the correct way to create and display a modal dialog. If it ca=
uses
a problem then you have more than one problem. But keep this code. =
As Joe
tried to tell you, we can't help much without knowing the details of the
assertion. Telling us that an assertion failed conveys very little
information, while the details of the assertion usually tell us a lot.
--
Scott McPhillips [VC++ MVP]
Hi,
Thanks so far.
I created a new ActiveX control project with only one event called
OnTryMe() and a methode called Test() that calls this event.
I created a new CDialog project and inserted the ActiveX.
I call this event like so:
void CTestEventDlg::OnBnClickedCallEvent()
{
// TODO: Add your control notification handler code here
m_TestCtrl.Test ();
}
BEGIN_EVENTSINK_MAP(CTestEventDlg, CDialog)
ON_EVENT(CTestEventDlg, IDC_TESTOCXCTRL1, 1, CTestEventDlg::OnTryMe,
VTS_NONE)
END_EVENTSINK_MAP()
void CTestEventDlg::OnTryMe()
{
// TODO: Add your message handler code here
CPromotionDlg m_PromDlg;
m_PromDlg.DoModal();
}
The modal dialog is now displayed and works perfectly.
There must be something wrong with my Chess ActiveX control because
its not working there.
I must look in to it more to figure out what i am doing wrong.
I will find out, but thanks for now and for the advise on programming.