Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MFC Extension DLL with OLE

Posted on 1998-04-20
5
Medium Priority
?
194 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 200 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…

886 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