ActiveX Printing

Hello All,
I use FastReport to print my own ActiveX object. I want go get it's interface while printing/previewing and to change some properties. I put OLE object in FastReport and named it as "Ole1". Then I tried to use OnBeforePrint event and write a handler like this (IMyCtl is my object's interface):
void __fastcall TForm1::frReport1BeforePrint(TStringList *Memo,
TfrView *View)
{
TfrOLEView *pOleView = dynamic_cast<TfrOLEView*> (View);
if (pOleView)
{
IMyCtl *pCtl;
if (SUCCEEDED(pOleView->OleContainer->OleObjectInterface->QueryInterface(__uuidof(IMyCtl),(void**)&pCtl)) && pCtl)
{
pCtl->SomeProperty = 5;
ShowMessage(IntToStr(pCtl->SomeProperty));
pCtl->Release();
}
}
}

Everything was fine: QueryInterface succeeded, and SomeProperty was successfully changed (ShowMessage showed 5). But nothing happened in preview window: object there was not changed. Later I tried to put a call to user-defined function REFRESH_PROPERTIES() in OLE Memo, and write almost the same code in OnUserFunction:
TfrOLEView *pOleView = dynamic_cast<TfrOLEView*> (frReport1->FindObject("Ole1"));
if (pOleView)
...

and I got the same situation: property was successfully changed, but OLE object in Preview window looked unchanged. It seems, that I access a valid pointer to another object. What can I do? Should I write my own component - descendant of TfrOLEView and can anybody give me a sample? Or is there an easier way?
Thank you very much.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.