calling com dll from C++
-
Hi, I had created dll using C# and I had been using that myLib.dll for long time. But today, I updated myLib.dll and register it again with RegAsm.exe and create the myLib.tlb file as I used to do. However my C++ program couldn't create Instance of dll because "The System cannot findthe file specified." error message today. What did I do wrong today? It was OK all time. I had updated myDll.dll so many time before and able to called from C++ program using the same function bool CClientJob::CoInitRoscoeLib(void) { m_roscoeLib = NULL; int retval = 1; CoInitialize(NULL); HRESULT hr = CoCreateInstance(CLSID_MyLib, NULL, CLSCTX_INPROC_SERVER, IID_IMyLib, reinterpret_cast(&m_myLib)); if (FAILED(hr)) { CString k; k.Format(L"Couldn't create the instance!... 0x%x\n", hr); AfxMessageBox(k); return false; } else return true; } in CClientJob.h i have #import "C:\Code\2007\03\RoscoeFuns\RoscoeFuns\bin\Debug\myLib_4.tlb" no_namespace named_guids Why the error message of HRESULT hr is " 0x80070002 The system cannot find the file specified. " Please help me out. Thank you so much.
-
Hi, I had created dll using C# and I had been using that myLib.dll for long time. But today, I updated myLib.dll and register it again with RegAsm.exe and create the myLib.tlb file as I used to do. However my C++ program couldn't create Instance of dll because "The System cannot findthe file specified." error message today. What did I do wrong today? It was OK all time. I had updated myDll.dll so many time before and able to called from C++ program using the same function bool CClientJob::CoInitRoscoeLib(void) { m_roscoeLib = NULL; int retval = 1; CoInitialize(NULL); HRESULT hr = CoCreateInstance(CLSID_MyLib, NULL, CLSCTX_INPROC_SERVER, IID_IMyLib, reinterpret_cast(&m_myLib)); if (FAILED(hr)) { CString k; k.Format(L"Couldn't create the instance!... 0x%x\n", hr); AfxMessageBox(k); return false; } else return true; } in CClientJob.h i have #import "C:\Code\2007\03\RoscoeFuns\RoscoeFuns\bin\Debug\myLib_4.tlb" no_namespace named_guids Why the error message of HRESULT hr is " 0x80070002 The system cannot find the file specified. " Please help me out. Thank you so much.
-
I did removed old dll from the debug and it works for one program but doesnt' work for the other program. Deleting dll from debug doesn't work.. I also tried to regasm /unregister "myLib.dll". If I go to RegEdit.. I saw lots of classes of myLib.dll repeatly. Do they suppose to be to appear in HEKY_CKASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_CONFIG. Was it because of memory? How am I going to clean old dll? Thanks
-
I did removed old dll from the debug and it works for one program but doesnt' work for the other program. Deleting dll from debug doesn't work.. I also tried to regasm /unregister "myLib.dll". If I go to RegEdit.. I saw lots of classes of myLib.dll repeatly. Do they suppose to be to appear in HEKY_CKASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_CONFIG. Was it because of memory? How am I going to clean old dll? Thanks
-
pnpfriend wrote:
I did removed old dll from the debug
That's not what I said. #import generates header files. If you don't study and understand the technology you use these sorts of problems are inevitable.
led mike
=( I know.. I tried to learn and I'm still trying to learn. I have the following line in the header file. #import "C:\NewLocation\myLib.tlb" no_namespace named_guids myLib.tlb is the new dll that I created. It is saved in Newlocation. The file actually exists in NewLocation folder. Was it that you were talking about? If I'm still wrong and misunderstanding you, Would you please refer me some links to study more about what I should know. Thank you Mike.
-
=( I know.. I tried to learn and I'm still trying to learn. I have the following line in the header file. #import "C:\NewLocation\myLib.tlb" no_namespace named_guids myLib.tlb is the new dll that I created. It is saved in Newlocation. The file actually exists in NewLocation folder. Was it that you were talking about? If I'm still wrong and misunderstanding you, Would you please refer me some links to study more about what I should know. Thank you Mike.
-
pnpfriend wrote:
Would you please refer me some links to study more about what I should know.
Here is good one[^] See the section "Header files created by import" Hope that helps
led mike