Help C++.Net2003 {0x80040154 Class not registered } Com Interop
I have a DLL that I created a strong name for using the SN -K
MyKeyFile.SNK. I then use the following command using the 2003.Net
Command prompt to Register the DLL for COM operations agains an
unmanaged C++ program.
D:\ADO.VS_NET_C++\ECMDb\Debug>regasm.exe ECMDb.dll /tlb:ECMDb.tlb
/codebase
Microsoft (R) .NET Framework Assembly Registration Utility 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Types registered successfully
Assembly exported to 'D:\ADO.VS_NET_C++\ECMDb\Debug\ECMDb.tlb', and the
type lib
rary was registered successfully
However when I run my code I get a {0x80040154 Class not registered }.
The funny thing is that this code worked before. I have tried
unregistering the Class and re-registering, but it does not work? Any
ideas? Help.. so close.. but yet soo far..
Client Code that access the dll
===================
#include "stdafx.h"
#include <direct.h>
#include <process.h>
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <memory.h>
#include <ctype.h>
#include <atlbase.h>
#import "D:\ADO.VS_NET_C++\ECMDb\Debug\ECMDb.tlb" raw_interfaces_only
using namespace ECMDb;
char msg[1000];
int _tmain()
{
// TODO: Please replace the sample code below with your own.
// Console::WriteLine(S"Hello World");
long lResult;
CComBSTR eng;
HRESULT hr = S_OK;
CoInitialize(NULL);
//MngDll::ICalculator* pMng = NULL;
//hr =
CoCreateInstance(MngDll::CLSID_Class1,NULL,CLSCTX_INPROC_SERVER,
// MngDll::IID_ICalculator,reinterpret_cast<void**>(&pMng));
try
{
eng.Empty();
IDLLPtr pIDll(__uuidof(DLL));
pIDll->Initialize();
IengLIST_dbPtr pIEng(__uuidof(engLIST_db));
eng.Append("900233");
pIEng->readEngine1(eng);
eng.Empty();
pIEng->get_eng_nbr(&eng);
wprintf(L"The result is %s", eng);
pIDll->Cleanup();
}
catch(const _com_error& Err)
{ //********** go out to message box
sprintf(msg," Catch Dll failure %s ",Err.ErrorMessage());
}//end catch
CoUninitialize();
return 0;
}