Error win32ole.prg => TOLEAUTO:ADJCLIENT(0)

Post Reply
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Error win32ole.prg => TOLEAUTO:ADJCLIENT(0)

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post 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() )
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post 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)
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

No oCrviewer doesn't have any property to put the window handle.

Antonio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio,

Thanks, problem solved.
Post Reply