Solved

IMPLEMENT_OLECREATE & Automation

Posted on 2006-12-01
4
819 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

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

Suggested Solutions

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

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

27 Experts available now in Live!

Get 1:1 Help Now