15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Problem with CFileDialog !

Tim Hagemann -- 100063.323@compuserve.com
Thursday, May 30, 1996

Hi MFC-folks !

Envi : Windows NT 4.0 beta, MSVC 4.1, MFC 4.1 

I got a little problem with the CFileDialog. After closing it with "Open", a
ASSERT apperars in a mfc-source file:

DLGFILE.CPP:

int CFileDialog::DoModal()
{
[snipsnip]

	_AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
	ASSERT(pThreadState->m_pAlternateWndInit == NULL);

	if (m_ofn.Flags & OFN_EXPLORER)
		pThreadState->m_pAlternateWndInit = this;
	else
		AfxHookWindowCreate(this);
[snipsnip]

	if (nResult)
		ASSERT(pThreadState->m_pAlternateWndInit == NULL); // THIS FAILS
	pThreadState->m_pAlternateWndInit = NULL;

[snipsnip]
}

Like you can see in the source file, the 'pThreadState->m_pAlternateWndInit'
member is set to 'this' and later checked for NULL (but only, if you press the
open button). 

My question is, what shall I do to avoid this assert or is it a simple MFC bug ?

Tim Hagemann
ifa informationssysteme

PS: It fails under Windows 95 too !




Frederic Steppe -- FredericS@msn.com
Sunday, June 02, 1996

>Envi : Windows NT 4.0 beta, MSVC 4.1, MFC 4.1 
>
>I got a little problem with the CFileDialog. After closing it with "Open", a
>ASSERT apperars in a mfc-source file:
>
>[snipsnip]
>	if (m_ofn.Flags & OFN_EXPLORER)
>		pThreadState->m_pAlternateWndInit = this;
>	else
>		AfxHookWindowCreate(this);
>[snipsnip]
>	if (nResult)
>		ASSERT(pThreadState->m_pAlternateWndInit == NULL); // THIS FAILS
>	pThreadState->m_pAlternateWndInit = NULL;
>
>My question is, what shall I do to avoid this assert or is it a simple MFC 
bug ?

Try removing the OFN_EXPLORER style.

Frederic Steppe (frederics@msn.com)




| Вернуться в корень Архива |