Solved

Ole Com

Posted on 2002-04-09
4
277 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…

825 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