Problem with ActiveX having another object as property!!!

A

Ahmad Jalil Qarshi

hi!

i have an activeX control for MS Word. this activeX control has few
properties including an object as a property. i create this inner object
when the ActiveX control is inserted into Word. i.e in the InitNew function.
then i store some data into this Inner object's property. I press save
button but when i go to close the document, it again ask me "Do you want to
save Doc4". if i click yes. document is closed but when i check the contents
of Inner object in DocFile Viewer. its empty.
i don't know why it happens.

furthermore if i reopen a document which contains my ActiveX control. how
can i get the data from inner Object's property.

i m using VC7.1 ,ATL COM

Ahmad Jalil Qarshi
 
I

Igor Tandetnik

Ahmad Jalil Qarshi said:
i have an activeX control for MS Word. this activeX control has few
properties including an object as a property. i create this inner
object when the ActiveX control is inserted into Word. i.e in the
InitNew function. then i store some data into this Inner object's
property. I press save button but when i go to close the document, it
again ask me "Do you want to save Doc4". if i click yes. document is
closed but when i check the contents of Inner object in DocFile
Viewer. its empty.
i don't know why it happens.

Does your inner object implement a persistence interface such as
IPersistStreamInit? Do you list it in the control's property map?
--
With best wishes,
Igor Tandetnik

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
 
A

Ahmad Jalil Qarshi

Thanks Igor.
yes i have implemented the persistance interface and also listed the inner
object as property in the COM_PROP_MAP of control. The thing which irritate
me is that if i insert some data into the property of the control and then
after saving the document when i go to close the Word y it again asks me "Do
you want to save Doc".

Ahmad Jalil Qarshi!
 
I

Igor Tandetnik

Ahmad Jalil Qarshi said:
yes i have implemented the persistance interface and also listed the
inner object as property in the COM_PROP_MAP of control. The thing
which irritate me is that if i insert some data into the property of
the control and then after saving the document when i go to close the
Word y it again asks me "Do you want to save Doc".

Looks like a problem with how IPersistStreamInit::IsDirty is
implemented. Check that after the control is saved for the first time,
IsDirty returns false both for the control itself and for the inner
object. If it does not, try to figure out why not.
--
With best wishes,
Igor Tandetnik

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
 
I

Igor Tandetnik

Ahmad Jalil Qarshi said:
yes i have implemented the persistance interface and also listed the
inner object as property in the COM_PROP_MAP of control. The thing
which irritate me is that if i insert some data into the property of
the control and then after saving the document when i go to close the
Word y it again asks me "Do you want to save Doc".

Looks like a problem with how IPersistStreamInit::IsDirty is
implemented. Check that after the control is saved for the first time,
IsDirty returns false both for the control itself and for the inner
object. If it does not, try to figure out why not.
--
With best wishes,
Igor Tandetnik

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top