﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
1963	Ticket 1658 Still Not Working in 3.3.7.10	mejonah@…		"This (closed, fixed) ticket:
http://www.autoitscript.com/trac/autoit/ticket/1658

still seems to be a problem in 3.3.7.10 when using Crystal Reports (11) via COM.  I wasn't sure whether to comment in the initial thread or start a new one, so sorry if I chose incorrectly.

The code below properly opens the report in 3.3.6.0, but causes a COM ""member not found error"" on the line $CR_ObjViewer.ReportSource = $CR_ObjReport (commented in the code).

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$oMyError = ObjEvent(""AutoIt.Error"",""MyErrFunc"")    ; Initialize a COM error handler

Func MyErrFunc()

  Msgbox(0,""AutoItCOM Test"",""We intercepted a COM Error !""      & @CRLF  & @CRLF & _
             ""err.description is: ""    & @TAB & $oMyError.description    & @CRLF & _
             ""err.windescription:""     & @TAB & $oMyError.windescription & @CRLF & _
             ""err.number is: ""         & @TAB & hex($oMyError.number,8)  & @CRLF & _
             ""err.lastdllerror is: ""   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             ""err.scriptline is: ""     & @TAB & $oMyError.scriptline     & @CRLF & _
             ""err.source is: ""         & @TAB & $oMyError.source         & @CRLF & _
             ""err.helpfile is: ""       & @TAB & $oMyError.helpfile       & @CRLF & _
             ""err.helpcontext is: ""    & @TAB & $oMyError.helpcontext _
            )

    Local $err = $oMyError.number
    If $err = 0 Then $err = -1

    $g_eventerror = $err  ; to check for after this function returns
Endfunc



$gui = guicreate(""TEST"", 500, 500)

$sReportName = FileOpenDialog(""Select RPT Source File"", ""."", ""RPT (*.rpt)"", 3)

if $sReportName <> """" and fileexists($sReportName) then
	$CR_ObjApp = ObjCreate(""CrystalRuntime.Application.11"")
	If $CR_ObjApp = 0 Then
		msgbox(0, ""Error"", ""Crystal Reports is not installed."", default, $gui)
	else
		$CR_ObjReport = $CR_ObjApp.OpenReport($sReportName)
		If $CR_ObjReport = 0 Then
			msgbox(0, ""Error"", ""Unable to open report."", default, $gui)
		else
			$CR_ObjViewer = ObjCreate(""CrystalReports11.ActiveXReportViewer.1"")
			$CR_ObjViewer.DisplayGroupTree = true

			;Creates an ActiveX control in the GUI.
			$ActiveX = GUICtrlCreateObj ( $CR_ObjViewer, 10, 10, 480, 480)

			$CR_ObjViewer.ReportSource = $CR_ObjReport  ;this line causes a COM error ""member not found"" in beta 3.3.7.10, but not in earlier non-beta versions
			$CR_ObjViewer.ViewReport
		endif
	endif
endif




Of course CR must be installed, here is a thread discussion on it: http://www.autoitscript.com/forum/topic/12813-crystal-reports-viewer-in-autoit/"	Bug	closed		AutoIt	3.3.7.10	None	Duplicate		
