bebonham
asked on
please help me!
I am working with this mfc/ole stuff that is driving me nuts.
the samples I have work fine, but when I remove the framework they have, and replace it with a console type version, the stuff no longer works...
this is the object I am trying to create:
class IDatabase : public COleDispatchDriver
{
public:
IDatabase() {} // Calls COleDispatchDriver default constructor
//continues...
I am trying to create it like this:
IDatabase Database;
then I try to use it:
Database.CreateDispatch("A CTOLE.DATA BASE", pException);
which I believe calls COleDispatchDriver::Create Dispatch
anyways, I get an exception when I do that...
and I'm not sure why.
please help me
the samples I have work fine, but when I remove the framework they have, and replace it with a console type version, the stuff no longer works...
this is the object I am trying to create:
class IDatabase : public COleDispatchDriver
{
public:
IDatabase() {} // Calls COleDispatchDriver default constructor
//continues...
I am trying to create it like this:
IDatabase Database;
then I try to use it:
Database.CreateDispatch("A
which I believe calls COleDispatchDriver::Create
anyways, I get an exception when I do that...
and I'm not sure why.
please help me
ASKER
okay, it must have been something else...sorry about this...feel stupid..but okay here is where I am now:
#include "StdAfx.h"
#include <iostream>
#include <string>
#include <fstream>
#include "actole.h"
#include "Actflds.h"
void ListContacts()
{
try
{
COleException *pException=new COleException;
IDatabase Database;
Database.CreateDispatch("A CTOLE.DATA BASE", pException);
Database.Open("C:\\My Documents\\ACT\\Database\\ Act5Demo.d bf");
IContact Contact;
LPDISPATCH contactDispatch = Database.GetContact();
//Contact.AttachDispatch(c ontactDisp atch, TRUE);
Database.Close();
Database.ReleaseDispatch() ;
}
catch(...)
{
TRACE("Detected Exception in CActcliDlg::OnListContacts () \n");
AfxMessageBox("Detected Exception in CActcliDlg::OnListContacts ");
}
}
int main()
{
ListContacts();
return 0;
}
now, if you uncomment that one line it throws an exception...
yes, the ACTOLE.DATABASE needs to be registered...
how can I get an answer on this...
what do you suggest I do?
I am not too good at the debugger...
#include "StdAfx.h"
#include <iostream>
#include <string>
#include <fstream>
#include "actole.h"
#include "Actflds.h"
void ListContacts()
{
try
{
COleException *pException=new COleException;
IDatabase Database;
Database.CreateDispatch("A
Database.Open("C:\\My Documents\\ACT\\Database\\
IContact Contact;
LPDISPATCH contactDispatch = Database.GetContact();
//Contact.AttachDispatch(c
Database.Close();
Database.ReleaseDispatch()
}
catch(...)
{
TRACE("Detected Exception in CActcliDlg::OnListContacts
AfxMessageBox("Detected Exception in CActcliDlg::OnListContacts
}
}
int main()
{
ListContacts();
return 0;
}
now, if you uncomment that one line it throws an exception...
yes, the ACTOLE.DATABASE needs to be registered...
how can I get an answer on this...
what do you suggest I do?
I am not too good at the debugger...
ASKER
here is what I think I got from the debugger..
Loaded 'C:\WINDOWS\SYSTEM\USER32. DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\ADVAPI3 2.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\GDI32.D LL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\KERNEL3 2.DLL', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\SYSTEM\MSVCRTD .DLL'
Loaded symbols for 'C:\WINDOWS\SYSTEM\MFC42D. DLL'
Loaded 'C:\WINDOWS\SYSTEM\OLE32.D LL', no matching symbolic information found.
Warning: CreateDispatch returning scode = CO_E_NOTINITIALIZED ($800401F0).
Warning: attempt to call Invoke with NULL m_lpDispatch!
what do the experts think?
Thanks,
Bob
Loaded 'C:\WINDOWS\SYSTEM\USER32.
Loaded 'C:\WINDOWS\SYSTEM\ADVAPI3
Loaded 'C:\WINDOWS\SYSTEM\GDI32.D
Loaded 'C:\WINDOWS\SYSTEM\KERNEL3
Loaded symbols for 'C:\WINDOWS\SYSTEM\MSVCRTD
Loaded symbols for 'C:\WINDOWS\SYSTEM\MFC42D.
Loaded 'C:\WINDOWS\SYSTEM\OLE32.D
Warning: CreateDispatch returning scode = CO_E_NOTINITIALIZED ($800401F0).
Warning: attempt to call Invoke with NULL m_lpDispatch!
what do the experts think?
Thanks,
Bob
ASKER
I think my problem is with this:
I am including afxdisp.h
AfxOleInit();
I am including afxdisp.h
AfxOleInit();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you!
you are correct, that is what I also found w/ help from the c++ ta.
problem is I am trying to do a console app :)
I tried the cpp OleInitialize() but that doesn't seem to jive quite right with the MFC stuff.
know any good places to learn about the structure of an MFC program...my problem is I can understand c++ structure enough, but all the different files and stuff that go into MFC are confusing.
Thanks,
Bob
you are correct, that is what I also found w/ help from the c++ ta.
problem is I am trying to do a console app :)
I tried the cpp OleInitialize() but that doesn't seem to jive quite right with the MFC stuff.
know any good places to learn about the structure of an MFC program...my problem is I can understand c++ structure enough, but all the different files and stuff that go into MFC are confusing.
Thanks,
Bob
I don't know of any really good places on the net. MFC has been around for a fair while so there are a ton of books out on it. I think that the Wrox book Professional MFC by Mike Blaczek (aak -- spelling!) is one of the most comprehensive. Mike was one of the original architects of MFC.
ASKER
yeah I have it...
great paperweight for beginners :)
great paperweight for beginners :)
Does it have to be registered?
Is it a ClassID?
Did you trace through each step of the creation in the debugger?
I made a sample app and it failed at getting the ClassID.
Hmmm...