Solved

Need a C++ non-MFC ActiveX Container

Posted on 1999-01-06
6
636 Views
Last Modified: 2013-11-25
I'm looking for a sample code of an ActiveX container application not using MFC. Something equivalent to the wrapper class created by the MFC wizard around ActiveX controls. I need to be able to display/resize the control in a child window in the client window of the app and access its methods and events. I don't need visual editing or access to property pages.
0
Comment
Question by:mridey
6 Comments
 

Author Comment

by:mridey
ID: 1181694
I'm using MS VC++ 6.0.
For example, if you have an AVI player ActiveX component and you want to design a non-MFC application that displays an AVI movie in the client window of the application. No need for property pages support or visual editing but the control should respond to SIZE/MOVE commands when the application is moved or resized.
0
 
LVL 23

Accepted Solution

by:
chensu earned 200 total points
ID: 1181695
http://users.neca.com/vmis/final1.htm

Although it uses MFC to build the application, it does implement the interfaces.
0
 
LVL 1

Expert Comment

by:martinortiz
ID: 1181696
Create an ATL project, after creating choose Insert New ATL Object from Insert menu. This will insert a MINUMAL COM complient activex control, if you compile the empty project it comes out to about 10k!
0
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.

 

Author Comment

by:mridey
ID: 1181697
To martinortiz: I don't understand your comment. Can I create a 'Container' from an ATL project. I though this was only to create ActiveX components.
Thanks
0
 
LVL 1

Expert Comment

by:shrif
ID: 1181698
To mridey: You can start with the sample ATL program called ATLCON that implements the container side of ActiveX controls -- very limited, though.

To chensu: I've looked at their solution and found it to be very useful.  However, as with all published solutions for creating ActiveX containers (including the MFC source), it is severly limiting.

If you want to create an activex control container such as the one VB or Visual C++'s dialog editor, you are going to have to do *a lot* of work.

To the original poster: Although you may not want to use MFC for solving this problem, you should know that it may be your best bet.  I was in the same boat as you, with a non-MFC C++ program that needed ActiveX control containment.  You can actually keep your C++ program as it is and simply link to the MFC libraries to use MFC for the parts that need containment.  The rest of your code can ignore that MFC is there.  In your WinMain, you have to call AfxWinInit() and then call AfxEnableControlContainer().  Search for "AfxWinInit" in the MFC knoweldgebase and you'll find an article that talks about using MFC from non MFC C++ programs.

Once you're there, you can simply create a CWnd object and call CreateControl to create the ActiveX control.
0
 
LVL 1

Expert Comment

by:shrif
ID: 1181699
To mridey: You can start with the sample ATL program called ATLCON that implements the container side of ActiveX controls -- very limited, though.

To chensu: I've looked at their solution and found it to be very useful.  However, as with all published solutions for creating ActiveX containers (including the MFC source), it is severly limiting.

If you want to create an activex control container such as the one VB or Visual C++'s dialog editor, you are going to have to do *a lot* of work.

To the original poster: Although you may not want to use MFC for solving this problem, you should know that it may be your best bet.  I was in the same boat as you, with a non-MFC C++ program that needed ActiveX control containment.  You can actually keep your C++ program as it is and simply link to the MFC libraries to use MFC for the parts that need containment.  The rest of your code can ignore that MFC is there.  In your WinMain, you have to call AfxWinInit() and then call AfxEnableControlContainer().  Search for "AfxWinInit" in the MFC knoweldgebase and you'll find an article that talks about using MFC from non MFC C++ programs.

Once you're there, you can simply create a CWnd object and call CreateControl to create the ActiveX control.
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

Suggested Solutions

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

895 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

18 Experts available now in Live!

Get 1:1 Help Now