?
Solved

ActiveX Control Container...non-MFC

Posted on 1998-12-16
3
Medium Priority
?
395 Views
Last Modified: 2013-12-03
I need to add ActiveX control containment to a non-MFC app.
The Visual C++ (6.0) Programmer's Guide has an on-line help
article: "Overview: Creating an ActiveX Control Container."
It refers to Chapter 19 of Adam Denning's book
"OLE Controls Inside Out" on how to do it for non-MFC apps.
I bought the 2nd edition of this book, "ActiveX Controls
Inside Out", and cannot find the answer anywhere.
Can somebody steer me in the right direction?
Thanks a lot!
0
Comment
Question by:bwilhelm
[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
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 750 total points
ID: 1417376
Look into the following article.

Makings of an OCX container
http://users.neca.com/vmis/final1.htm

Although it uses MFC to build the application, it does implement the interfaces. You may adapt it for your own use.
0
 

Author Comment

by:bwilhelm
ID: 1417377
The page you pointed me to was helpful.
However the example needed to tweaked quite a bit.
For the sake of others, here's what I come up with:

#include <ole2.h>
#include <oleauto.h>
#include <initguid.h>
#include <olectl.h>

#define MY_ACTIVEX_CONTROL_NAME      OLESTR("AVCALC.AvCalcCtrl.1")
.

// setup once at the beginning
OleInitialize(NULL);

.

// create the Active X control
CLSID z_Clsid;
HRESULT hres=CLSIDFromString(MY_ACTIVEX_CONTROL_NAME,&z_Clsid);
if(hres!=S_OK)
      return;

IClassFactory *z_pClassFactory;
IOleObject *z_pOleObject;

CoGetClassObject(z_Clsid,1,0,IID_IClassFactory,(void**)&z_pClassFactory);
z_pClassFactory->CreateInstance(0,IID_IOleObject,(void**)&z_pOleObject);
z_pOleObject->DoVerb(OLEIVERB_OPEN,0,0,-1,hMainWnd,(RECT*)0);

.

// cleanup at the end of program
OleUninitialize();


0
 

Expert Comment

by:riow
ID: 14646413
The link doesn't work!
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

764 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