Solved

ActiveX Control Container...non-MFC

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…

734 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