Solved

IMPLEMENT_OLECREATE & Automation

Posted on 2006-12-01
4
815 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
Comment Utility
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
Comment Utility
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
Comment Utility
Aplogies,

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

0
 

Author Comment

by:wdhough
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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 explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

12 Experts available now in Live!

Get 1:1 Help Now