Solved

Ole Com

Posted on 2002-04-09
4
275 Views
Last Modified: 2013-12-03
Hello Experts...
Did any one hear about Mapinfo?.

Well.... The provide the following file: "mapinfow.h"

It looks something like this...

class DMapInfo : public COleDispatchDriver
{
// Attributes
public:

// Operations
public:
     // method 'QueryInterface' not emitted because of invalid return type
     // method 'AddRef' not emitted because of invalid return type
     // method 'Release' not emitted because of invalid return type
     LPDISPATCH GetApplication();
     LPDISPATCH GetParent();
     CString GetName();
     CString GetFullName();
     CString GetVersion();
     BOOL GetVisible();
     void SetVisible(BOOL bNewValue);
     long GetLastErrorCode();
     void SetLastErrorCode(long nNewValue);
     CString GetLastErrorMessage();
     LPDISPATCH GetMBApplications();
     void Do(LPCTSTR command);
     CString Eval(LPCTSTR expression);
     void RunCommand(LPCTSTR command);
     void RunMenuCommand(short id);
     LPUNKNOWN DataObject(long windowID);
     void SetCallback(LPDISPATCH callbackobject);
};

There are some other classes defined...
The problem is that they are classes derived from MFC....
And I am not using (And I refuse to :-) MFC.

Can any one tell me how to create an object like this but not using MFC?....

Thankks
0
Comment
Question by:Marsc
4 Comments
 
LVL 7

Accepted Solution

by:
peterchen092700 earned 200 total points
Comment Utility
>> The provide the following file
you mean "The clazz wizard provides..:" ?

You can use the #import directive to import the type library, doesn't require MFC, and the generated wrapper classes are much better IMO. However, you need to be proficient with exception handling.

#import "typelibrary.tlb/dll/whatever" rename_namespace("nsMyTypeLib")

try {
  nsMyTypeLib::IMapInfoPtr pMI; // Interface name + "Ptr"
  pMI.CreateInstance(__uuidof(MapInfo/* Co Class Name */));
  pMI->Method();
}
catch (_com_error ce) {
  ce.ReportError(); // or whatever to handle the error
}
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…

762 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

11 Experts available now in Live!

Get 1:1 Help Now