Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using AtlAxCreateControl and unloading controls

Posted on 2001-07-23
5
Medium Priority
?
710 Views
Last Modified: 2013-11-20
Hi all,

I am using the ATL function AtlAxCreateControl to create an ActiveX control at run time, using my dialog box as the parent window.

My product requires a functionality that, I must also be able to unload this dynamicaly created ActiveX control at run time. By unloading , I mean , destroying the control window (if it had one) and freeing all the associated resources.

Any comments/suggestions is welcome ?

Thanks in advance


0
Comment
Question by:saurabh_dasgupta
[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
5 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6313222
I'd use CAxWindow::CreateControl/Ex instead it calls AtlAxCreateControl internally and wraps it up in an easy to manipulate object
0
 
LVL 4

Author Comment

by:saurabh_dasgupta
ID: 6316105
Thanks for the reply. I have just managed to get hold of some code from a MSDN article titled:
"Write ActiveX Controls Using Custom Interfaces Provided by ATL 3.0"

In this article I observed that the approach should be:

(i)Creat an instance of CAxWindow
(ii)Query for the interface IAxWinHostWindow using QueryHost method of CAxWindow
(iii)Use the method CreateControl of IAxWinHostWindow to create the OLE control
(iii)Remember a reference to the IUnknown of the OLE control
(iv)When the time to unload comes, use the IOleObject::Close  method

I am still not able to understand why the OLE control pointer returned from a direct call to AtlAxCreate.. Or CAxWindow wont give me an IOleObject interface when I do a query interface ??? Wheras the IAxWinHostWindow approach is absolutely fine ...!!!

Thanks



0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6316291
I couldn't say without further investigation but the ATL source code might hold a clue as IAxWinHostWindow is an ATL interface - it seems that as it is a wrapper then a simple QI on the interface would not work so it exposes a method that allows you to access the wrapped object - I hope this answers you question
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9490552
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ'd and pts refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9537144
PAQed, with points refunded (200)

Computer101
E-E Admin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

636 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