Solved

MFC Extension DLL with OLE

Posted on 1998-04-20
5
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…

635 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