Click to See Complete Forum and Search --> : Cant Describe It?


Talal Tayyab
May 19th, 1999, 09:51 AM
I am calling multiple dialog's from my SDI view Class , the problem is that i get an assertion failure when i call my dialog for the second time. I traced the problem to the following code, written on InitDialog.

m_tip.Create(this)

This is a MFC tooltip class taken from code guru! I have tried to destroy the object m_tip , i have tried to destroy the window but nothing seems to work ... Could somebody help me !!

BrianOG
May 20th, 1999, 05:13 AM
I presume m_tip is a CWnd derived class....
You could check to see if it has already been createdif ( !::IsWindow(m_tip.m_hWnd) )
m_tip.Create(this);

Or if you need to force the window to destory you could try something like this:if ( ::IsWindow(m_tip.m_hWnd) )
{
HWND hWnd = m_tip.Detach();
if ( hWnd )
::DestroyWindow(hWnd);
}
m_tip.Create(this)

You might beed to play around with it a bit, but this should be the general idea.

Talal Tayyab
May 20th, 1999, 10:02 AM
Thanx for your advice , i will try it out...
But i have another problem too! I have succesfully displayed a toolbar in a dialog box but the second time i call the dialog box the LoadToolbar functions returns an error. Although the program functions normally but the toolbar images are not loaded!
Can you help me ????