Page 1 of 1
Error win32ole.prg => TOLEAUTO:ADJCLIENT(0)
Posted: Sat Dec 15, 2007 4:35 pm
by AHF
I'm getting this error working with activex crystal reports. Does anyone knows the reason?
When the window with the oViewer control gets activated I get the error.
Otherwise all ole control of the object works ok.
Any ideas ?
Antonio
Posted: Sat Dec 15, 2007 4:52 pm
by Antonio Linares
Are you using xHarbour ?
If yes, then add this before using TOleAuto:
EXTEND CLASS TOLEAUTO WITH METHOD AdjClient
static function AdjClient() ; return nil
Posted: Sun Dec 16, 2007 10:12 am
by AHF
Antonio,
Thanks, but now the viewer object doesn't apper on the window.
The reports works ok to the printer but not to the screen.
Here is the code that should work ok.
DEFINE WINDOW oWnd TITLE cTitle
oCRViewer := ToleAuto():New("CrystalReports.ActiveXReportViewer" )
oCRViewer:EnableExportButton :=1
oCRViewer:EnableStopButton:= 1
oCRViewer:EnableNavigationControls:=1
oCRViewer:EnablePopupMenu:=0
oCRViewer:EnableCloseButton:=0
if lPcdata
oCRViewer:DisplayGroupTree:=0
oCRViewer:EnableDrillDown:=0
oCRViewer:EnableGroupTree:=0
endif
oCRViewer:ReportSource:= oReport
oCRViewer:ViewReport()
oCrViewer:Zoom:=75
oWnd:oClient := oCRViewer
ACTIVATE WINDOW oWnd MAXIMIZED ;
VALID (oReport:CancelPrinting(),oCrystal:CanClose() )
Posted: Sun Dec 16, 2007 10:29 am
by Enrico Maria Giordano
This is a sample that I successfully tried in the past (please note that I don't have CR installed now and therefore I can't test it anymore):
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oCrystal := CREATEOBJECT( "CrystalRuntime.Application" )
LOCAL oReport := oCrystal:OpenReport( "PROVA.RPT" )
LOCAL oWnd, oCRViewer
DEFINE WINDOW oWnd
oCRViewer = TActiveX():New( oWnd, "CRViewer9.CRViewer" )
oCRViewer:SetProp( "ReportSource", oReport )
oCRViewer:Do( "ViewReport" )
oWnd:oClient = oCRViewer
ACTIVATE WINDOW oWnd;
MAXIMIZED
RETURN NIL
EMG
Posted: Sun Dec 16, 2007 10:37 am
by AHF
Basiclly codes are identical. I use Cr 11 so the app ids changed.
It used to work with previous version of Harbour (don't know versiom) but now with xHarbour March 2006 and FWH March 2006 it doesn't anymore.
Antonio
Posted: Sun Dec 16, 2007 10:57 am
by Antonio Linares
Antonio, Enrico,
Does oCRViewer provide a property to access its window handle ?
That is what we need to make AdjClient() work fine
Enrico's example is using a TActiveX which is derived from TControl, so AdjClient() works fine with it
Posted: Sun Dec 16, 2007 11:31 am
by AHF
Changing from toleauto to tactivex I get the error :
Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: HWND
Args:
Stack Calls
===========
Called from: => HWND(0)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: TActiveX.prg => CREATEACTIVEX(184)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: crtfwup.PRG => MAIN(275)
Posted: Sun Dec 16, 2007 12:23 pm
by AHF
No oCrviewer doesn't have any property to put the window handle.
Antonio
Posted: Sun Dec 16, 2007 3:48 pm
by Antonio Linares
Antonio,
Are you using xHB commercial ?
It looks so as you are linking Class TActiveX from xHB commercial instead of Class TActiveX from FWH
Posted: Sun Dec 16, 2007 4:52 pm
by AHF
Antonio,
Thanks, problem solved.