Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need a C++ non-MFC ActiveX Container

Posted on 1999-01-06
6
Medium Priority
?
681 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
[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
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 600 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

719 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