|
-
April 4th, 2006, 10:28 AM
#1
[RESOLVED] Weird CoCreateInstance error
Hi everyone!
I'm writing a data conversion program for my company. I have an ActiveX DLL that was written in VB6, which I know works. I'm writing the interface in Win32 API/C++ because I want to use the CreateThread API to run the data conversion in (it's a long process). I already have my interface written, but my problem comes when I try to use my DLL in my C++ project.
1. I know for a fact the DLL is registered.
2. I used OLE View after registering the DLL to get the IDL file information, and ran midl on it to get my header file and C file.
3. I've imported these into my project and #included the header file in my main .cpp file.
Here's the offending code:
Technical:
//initialize my COM dll
_DBWorker *dbw = NULL;
HRESULT hr;
hr = CoInitialize(0);
if(SUCCEEDED(hr)) {
hr = CoCreateInstance(CLSID_DBWorker, NULL, CLSCTX_INPROC_SERVER, IID__DBWorker, (void**) &dbw);
if(FAILED(hr)) {
_com_error err(hr);
MessageBox(NULL, err.ErrorMessage(), "error", MB_OK);
CoUninitialize();
return(0);
}
}
|
The _com_error returns 0x800A0036, which I have found out to be a CTL_E_BADFILEMODE error. Further Google-ing has not clued me in to why this error is being given.
Thank you for any help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|