Re: member variables scope in atl com dll...
Thank you for your prompt response. I am sending below code snippet.
m_objDatabase is null when I am calling UseDatabase funnction. I would like
m_objDatabase without static.
How? Please suggest me.
class ATL_NO_VTABLE CMyTest :
public CComCoClass<CMyTest, &CLSID_MyTest>,
public IDispatchImpl<IMyTest, &IID_IMyTest, &LIBID_MyTest1Lib>
STDMETHOD(GetRawData)(UINT SeqId, BSTR* RawData,INT* BlockLen);
STDMETHOD(FileRestore)(BSTR* UserName, BSTR* EncryptionPassword, BSTR*
STDMETHODIMP CMyTest::OpenDatabase(BSTR* username)
m_userName = *username;
// TODO: Add your implementation code here
m_objDatabase= new CMyDatabase();
//here m_objDatabase is getting null. I want to use m_objDatabase in this
function and already created in Opendatabase funcion.
if (m_objDatabase != NULL)
Thanks & Regards,
"Igor Tandetnik" wrote:
John <John@discussions.microsoft.com> wrote:
I have developed atl com dll. It IMyTest interface and it is
implemented on CMyTest class. Object of CMyDatabase is the member
variable of CMyTest class.
IMyTest has three fuctions which are : 1. OpenDatabase, 2.
In client side, OpenDatabase got succeded. But, application is getting
crash when UseDatabase function called. The object of CMyDatabase is
null in UserDatabase function. Any solution is there for this?
The code you show is fine. The problem must be in the code you don't
show. Show the declaration of CMyTest class, and how CMyDatabase member
is declared. Show the code in OpenDatabase and UseDatabase. Show the
exact line were the crash occurs.
With best wishes,
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925