哈哈,
添加接口
IPersistPropertyBag
添加声明
function IPersistPropertyBag.InitNew = PersistPropBagInitNew;
function IPersistPropertyBag.Load = PersistPropBagLoad;
function IPersistPropertyBag.Save = PersistPropBagSave;
function PersistPropBagInitNew: HResult
stdcall;
function PersistPropBagLoad(const pPropBag: IPropertyBag;
const pErrorLog: IErrorLog): HResult
stdcall;
function PersistPropBagSave(const pPropBag: IPropertyBag;
fClearDirty: BOOL
fSaveAllProperties: BOOL): HResult
stdcall;
// -- implement PersistPropBagInitNew
function TActiveFormX.PersistPropBagInitNew: HResult;
begin
Result := S_OK;
end;
// -- implement PersistPropBagLoad
function TActiveFormX.PersistPropBagLoad(const pPropBag:
IPropertyBag
const pErrorLog: IErrorLog): HResult
stdcall;
var
v: OleVariant;
begin
if pPropBag.Read('Caption', v, pErrorLog) = S_OK then
Label1.Caption := v;
Result := S_OK;
end;
// -- implement PersistPropBagSave
function TActiveFormX.PersistPropBagSave(const pPropBag:
IPropertyBag
fClearDirty: BOOL
fSaveAllProperties: BOOL)
: HResult
stdcall;
var
v: OleVariant;
begin
v:= Label1.Caption;
pPropBag.Write('Caption', v);
Result := S_OK;
end;
function IPersistPropertyBag.InitNew = PersistPropBagInitNew;
function IPersistPropertyBag.Load = PersistPropBagLoad;
function IPersistPropertyBag.Save = PersistPropBagSave;
function PersistPropBagInitNew: HResult
stdcall;
function PersistPropBagLoad(const pPropBag: IPropertyBag;
const pErrorLog: IErrorLog): HResult
stdcall;
function PersistPropBagSave(const pPropBag: IPropertyBag;
fClearDirty: BOOL
fSaveAllProperties: BOOL): HResult
stdcall;