Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ActiveX Control Container...non-MFC

Posted on 1998-12-16
3
Medium Priority
?
400 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
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…

610 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