Solved

Need a C++ non-MFC ActiveX Container

Posted on 1999-01-06
6
630 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

708 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

14 Experts available now in Live!

Get 1:1 Help Now