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

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

Postby AHF » Sat Dec 15, 2007 4:35 pm

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

Postby Antonio Linares » Sat Dec 15, 2007 4:52 pm

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

Postby AHF » Sun Dec 16, 2007 10:12 am

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

Postby Enrico Maria Giordano » Sun Dec 16, 2007 10:29 am

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  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby AHF » Sun Dec 16, 2007 10:37 am

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

Postby Antonio Linares » Sun Dec 16, 2007 10:57 am

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

Postby AHF » Sun Dec 16, 2007 11:31 am

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: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » Sun Dec 16, 2007 12:23 pm

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

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Antonio Linares » Sun Dec 16, 2007 3:48 pm

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

Postby AHF » Sun Dec 16, 2007 4:52 pm

Antonio,

Thanks, problem solved.
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 59 guests