Solved

MFC Extension DLL with OLE

Posted on 1998-04-20
5
159 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…

920 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

17 Experts available now in Live!

Get 1:1 Help Now