Solved

ActiveX Control Container...non-MFC

Posted on 1998-12-16
3
357 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
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 250 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…

705 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

15 Experts available now in Live!

Get 1:1 Help Now