Solved

MFC Extension DLL with OLE

Posted on 1998-04-20
5
149 Views
Last Modified: 2013-11-25
I am building dialog based Dynamic Link Library.  In the dialog there are some ActiveX controls.  Everytime I call a function which is refering some of the ActiveX controls I got some assertion failure saying that the m_CtrlSite is NULL.  Please help solve this probelm.



Regards

S. Sun.
0
Comment
Question by:shaozhuang
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1300720
If you are building shared DLL did you call AgxOleInit and AfxEnableControlContainer from DLL's InitInstance? If you are building MFC extension DLL you must call these two function insede application's InitInstance
0
 

Author Comment

by:shaozhuang
ID: 1300721
I checked  Galkin idea, it did not work. I also tried using AfxLockOleControl(), it did not work either.  There are must be some ways to do it.  Could somebody help?

Regards

S.Sun
0
 
LVL 7

Expert Comment

by:galkin
ID: 1300722
Could you post a piece of code how you create ActiveX controls
0
 

Author Comment

by:shaozhuang
ID: 1300723
Hi galkin: Thanks for the help.  The ActiveX controls reside in the dialog and I asign(using calsswizard) a name for it.  In my code I call this name for some of the subroutines. WHen I call it, it give me an error saying that the m_CtrlSIte is NULL.  Do you think I need to implement a subroutine to initialize the DLL(even I use implicit initialization.

Thanks again

S. Sun

0
 
LVL 7

Accepted Solution

by:
galkin earned 100 total points
ID: 1300724
m_pCtrlSite is a member of CWnd class that is wrapper of ActiveX control. When control is created using by CreateControl function or from dialog template this member becomes not NULL. If creating control failed this member remains NULL. Your probelm I guess is that your ActiveX control(s) failed to be created by some reason. Check it. Enable OLE tracing and see output.  
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now