Board index » Visual Studio » DoModal Broken in Debug Mode in VS2005 SP1

DoModal Broken in Debug Mode in VS2005 SP1

Visual Studio281
A new test was added to dlgcore.cpp in SP1 that breaks the DoModal

call in debugging mode.



In the function CreateDlgIndirect() line 239:



#ifdef _DEBUG

if ( AfxGetApp()->IsKindOf( RUNTIME_CLASS( COleControlModule ) ) )

{

TRACE(traceAppMsg, 0, "Warning: Creating dialog from within a

COleControlModule application is not a supported scenario.\n");

}

#endif



AfxGetApp() returns NULL since there is no parent hence...boom.

Release version works fine since this check is not made.



Is there a way around this to fake a parent or...?


-
 

Re:DoModal Broken in Debug Mode in VS2005 SP1

I'd be more concerned that the reason you are getting this error because there is

something wrong with your program. If you are saying that AfxGetApp() returns NULL, this

is indicative of a serious problem. Note that AfxGetApp is not associated with the

concept of parent (go read the code!)



Show your code and give us some more context. You might have been getting away with

something in the past that is now properly diagnosed as an error.

joe

On 28 Mar 2007 09:39:09 -0700, derekvv@gmail.com wrote:



Quote
A new test was added to dlgcore.cpp in SP1 that breaks the DoModal

call in debugging mode.



In the function CreateDlgIndirect() line 239:



#ifdef _DEBUG

if ( AfxGetApp()->IsKindOf( RUNTIME_CLASS( COleControlModule ) ) )

{

TRACE(traceAppMsg, 0, "Warning: Creating dialog from within a

COleControlModule application is not a supported scenario.\n");

}

#endif



AfxGetApp() returns NULL since there is no parent hence...boom.

Release version works fine since this check is not made.



Is there a way around this to fake a parent or...?

Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm

-