Solved

Ole Com

Posted on 2002-04-09
4
276 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
ID: 6940392
>> 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
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…

863 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

23 Experts available now in Live!

Get 1:1 Help Now