Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 16th, 2007, 05:13 AM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default MFC App fails trying to display a dialog cont

Hi all,

I am working on a dialog-based MFC application, which consists of multiple property pages. From one of the property pages, I am trying to launch a dialog box which contains an ActiveX control.

This is currently not working and the application exits with an access violation error when I call DoModal for the dialog. On debugging, I see this is due to AfxGetThread() returning NULL in AfxOleInit(). A subsequent statement in AfxOleInit() tries to dereference this NULL pointer. This does not happen if I launch the dialog-box from the application's InitInstance() function instead of a property page or if I add the control to the property page itself. I have made sure that the control is registered and that I call AfxEnableControlContainer() from the application's InitInstance() function.

I am using Visual Studio C++ .NET.

Is there something else that I have missed? Any help is greatly appreciated.

Thanks,
Priya
 
Old August 16th, 2007, 10:55 AM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just realized that this is happening because I am launching the dialog with the ActiveX control from a thread spawned by the parent property page's message thread. Everything works fine if I launch it directly from one of the event handlers of the property page. Could someone please tell me if there is a way to solve this?

Thanks,
Priya





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar(cont) ironchef Pro JSP 0 February 9th, 2008 07:54 PM
replace Word dialog with my designing dialog doublelucky Visual C++ 0 March 19th, 2007 02:27 AM
dialog display when viewing the report thiNkspAce Crystal Reports 1 March 27th, 2006 01:53 AM
Authentication fails unless app is running on IIS tobriant BOOK: ASP.NET Website Programming Problem-Design-Solution 1 December 14th, 2004 10:20 PM
Cont\ent Types jbenson001 ASP.NET 1.x and 2.0 Application Design 4 February 6th, 2004 01:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.