Click here to Skip to main content
12,883,875 members (39,739 online)
Rate this:
Please Sign up or sign in to vote.
See more: MFC VisualC++
Hello, I am new to VC++ automation concept. I am using VC++ 6.0 and one of my application was executing fine. But I dont know what exactly happened and the CreateDispatch() is creating an error. Its failing and "component not found" is the error message.

if(a.CreateDispatch("Cognitive.a")) //Creates an IDispatch interface object and attaches it to the COleDispatchDriver object.
AfxMessageBox("Cognitive.a component not found");

Pls help me out.
Posted 10-Jun-13 23:36pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Pass a pointer to a COleException object to CreateDispatch() to get detailed error information as shown in the MSDN[^]. This should not have changed since VC 6. But you should lookup the same in the VC 6 documentation.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

"Cognitive.a" is supposed to be the programmatic identifier of the object that you want to create the IDispatch interface for. If this code worked since years and all of a sudden it does no longer than I would assume that there is no longer a "Cognitive.a" object around at the time you make this call. It is hard to tell for what reason and how to solve that without knowing more about the environment and application. So look for any changes you made in your configuration and installed OLE components.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

I added one more line while initialization

const IID DIID__IRecognitionEvents = {0x229C1071,0x829F,0x11D2,{0xBA,0x6E,0x00,0x00,0xE8,0xD9,0xFD,0xF6}};

I found it on internet. Its working fine. But what exactly is this line doing I dont understand. If anybody knows what this line is doing pls help me.

Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170422.1 | Last Updated 17 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100