Solved

ActiveX Control Container...non-MFC

Posted on 1998-12-16
3
380 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

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…
I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
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…

830 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