Discussion Locked

How to print Crystal Report from DLL?

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
i would like to print a pre-designed Seagate Crystal Report 8.0 from an VB6 ActiveX DLL but i can't seem to add the necessary OCX into the class modules. can anyone suggest me some ideas? i've tried to include the OCX in a Form and then load the form in the class module in order to perform a print. this works fine in a standard VB6 EXE, but it gives runtime error when i pasted the code into an ActiveX DLL.

6 replies

by glen_mcleod

Nope, can't reference this OCX from an ActiveX .DLL, what you're going to have to do is go the CRAPI route, lol. (That's Crystal Repotrs API). You'll have to set a reference to the Crystal Report Engine 8 Library, cpeaut32.dll.

It's complex andtime consuming, but not necessarily hard, if you see the difference. The documentation that came with the package should help you, but unless they've improved it a lot, you'll do a fair bit of flipping back and forth between sections.

Glen

by dragon emperor

There are 2 ways you could solve this problem. The first way is the one you tried, to put the OCX on a form and create a variable of that form type in the DLL (not just referencing the form name like mosy people do in EXEs). The second way is to use CreateObject to create a variable of the type the OCX is (but this solution is more complicated and has some tricky nuances). In most cases it is easiest to just use a form.

by ohjani

i've tried both your solutions and finally i found out that it's MTS that caused the problem. everything was absolutely fine after i took away the MTS part, but the runtime error came out immediately when i added the DLL to MTS. any idea why?

by ohjani

DragonEmperor, could u pls further illustrate on how to use the CreateObject method (eg: which OCX to include and etc) just in case the first one failed?

This discussion is closed to new replies.