Re: OLE document modified

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Pavol (p.stolc_at_atlas.sk)
Date: 05/25/04


Date: Tue, 25 May 2004 09:05:39 +0200

TOleContainer is defined as follows:
type TOleContainer = class(TCustomControl, IUnknown, IOleClientSite,
    IOleInPlaceSite, IAdviseSink, IOleDocumentSite, IOleUIObjInfo);

Can you be more precissely what interface of listed above to use? Trying to
query the object for IPersistStreamInit or IPersistStream I get only
E_NOINTERFACE error. A sample in any programming language would be more
clearifying.
Thanks.

"Igor Tandetnik" <itandetnik@mvps.org> píše v diskusním příspěvku
news:%23Nnh%23FaQEHA.3708@TK2MSFTNGP10.phx.gbl...
> "Pavol" <anonymous@discussions.microsoft.com> wrote in message
> news:83613C35-BBED-4425-82F1-CC7D94DB0006@microsoft.com
> > type
> > OleDoc: TOleContainer;
> > FMemoryStream: TMemoryStream;
> > ...
> > OleDoc.LoadFromStream(FMemoryStream); // data from database
> > OleDoc.DoVerb(ovPrimary); // set osUIActive state
> > OleDoc.Modified := False;
> >
> > now is the document loaded and ready for editing. The problem is how
> > to know, if this document was changed by user.
>
> The OLE way is to query the object for IPersistStreamInit (or whatever
> persistent interface you initialized it with) and call IsDirty method.
> Since I don't know what TOleContainer is (it looks like a Delphi class)
> I can't comment on how its Modified method works. Last I checked, Delphi
> shipped with source code for the library, so you can see for yourself.
> --
> With best wishes,
> Igor Tandetnik
>
> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken
>
>