Solved

Need a C++ non-MFC ActiveX Container

Posted on 1999-01-06
6
649 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Poor Man's .NET Framework Certification 2 59
Problem to file 3 82
Unable to start eclipse ? 17 152
boost::uuid crashes 17 10
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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.
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.

809 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