>BTW, I am using Crystal 5, maybe Crystal 6 doesnt require an HWND?
Here's the code that we use:
The first thing you need to know is that the CR ActiveX Control is written in VB, so in the Init of your form, you need:
= SYS(2333, 1)
* This code is the the cmdPrint.Click
WITH ThisForm
* Activate the Crystal Reports control to display/print the report.
* Set the CR .RPT filename
.oleCrystal.ReportFileName = lcCrystalDir + ALLTRIM(vReports.ReportForm) + ".RPT"
* The destination is a valid CR value.
.oleCrystal.Destination = RepOutpu.Destination
* The Print File Type is a valid CR value
.oleCrystal.PrintFileType = RepOutpu.PrintFileType
* This is the output file name if going to a file
.oleCrystal.PrintFileName = .cntOutputFile.txtFileName.Value
* The report description to display on the preview window caption if previewing
.oleCrystal.WindowTitle = TRIM(vReports.Description)
* Cancel the error handler to avoid a bug in Crystal Reports ActiveX control.
* This bug causes an OLE error when the user cancels the report
lcOnError = ON("ERROR")
ON ERROR *
* Activate Crystal Reports
.oleCrystal.Action = 1
* Reset the error handler
ON ERROR &lcOnError.
ENDWITH
You should also be aware that we use PRGs to create report files and then save the report cursors, then COPY TO TYPE FOX2X. CR needs ODBC to access VFP tables, but will directly use Fox 2X files.
You should also look at TECHREF.PDF that ships with CR.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer