Solved

IMPLEMENT_OLECREATE & Automation

Posted on 2006-12-01
4
826 Views
Last Modified: 2013-11-20
Hi,

I am trying to enable OLE automation in one of my applications.  I want to use the IMPLEMENT_OLECREATE macro, however i am having difficulty.

this is the macro as mentioned on the msdn website.

IMPLEMENT_OLECREATE(class_name, external_name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8 )

I have several questions.

1.  class_name - What class  my CWinApp Derived class?
2. i understand the " l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8 " part is the clsid of the application.  How do i find out what my clsid for my app is?

thanks, also if you can point me in the direction of a good how to do on this that would appreciated
0
Comment
Question by:wdhough
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 250 total points
ID: 18055170
Look here : http://msdn2.microsoft.com/en-us/library/ms861541.aspx

IMPLEMENT_OLECREATE macro, which allows instances of a CCmdTarget-derived class to be created by Automation clients.

The Guidgen.exe GUID generator is supplied with the Microsoft Visual C++ development system.

-MAHESH
0
 

Author Comment

by:wdhough
ID: 18068330
Mahesh,

Thanks for your response.  I have managed to do that. but when compiling now it says

c:\test\apps\MyApp.cpp(54): error C2039: 'factory' : is not a member of 'MyApp'
c:\test\apps\MyApp.cpp(54): error C2039: 'guid' : is not a member of 'MyApp'
c:\test\apps\MyApp.h(7) : see declaration of 'MyApp'
c:\test\apps\MyApp.cpp(54): error C2065: 'guid' : undeclared identifier
c:\test\apps\MyApp.cpp(54): error C2039: 'guid' : is not a member of 'MyApp'
c:\test\apps\MyApp.h(7) : see declaration of 'MyApp'
c:\test\apps\MyApp.cpp(54): error C2373: 'guid' : redefinition; different type modifiers
0
 

Author Comment

by:wdhough
ID: 18068501
Aplogies,

I left out the DECLARE_OLECREATE(name) in the .h file.

0
 

Author Comment

by:wdhough
ID: 18070140
Mahesh,  I know have most of the application up and running (so to speak).  My application is an Exe that has interfaces in it that external applications can access and use for automation.  I have added a new interface for my new class.  I have written a quick app (in c#), litterally a form with a button on it, that when clicked should instantiate my application object.

The problem i am receiving is

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication1.exe
 Additional information: COM object with CLSID {157A834E-77AD-4012-8437-3BB3C9007E2E} is either not valid or not registered.

I have checked through the object browser and it can see the object i am trying to instantiate, i have taken this project over from someone else who set up the other interfaces and i dont know how they "registered" them.  Any ideas

Many thanks

Will
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generic progress indicator 6 117
WinWaitActive parameters 12 31
countEvens challenge 2 112
post4 challenge 28 104
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seveā€¦
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

829 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