Solved

Need a C++ non-MFC ActiveX Container

Posted on 1999-01-06
6
642 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 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