-
How can I catch the 'close' event from a Crystal Report viewer preview window? The help given in the Seagate help files doesn't help me much.
I do something like.....
Code:
Set crwApp = CreateObject("Crystal.crpe.application")
Set crReport = crwApp.OpenReport("D:\DVD Ordering System\Reports\DVD002.rpt")
Set repView = crReport.Preview
which is fine except that the viewer is not modal. I either want to be able to set the view to modal or loop until the viewer is closed by the user - but I don't know how to achieve either!
-
I do this with the Crystal Reports API.
you have to do something like the following:
Code:
lngResult = PEStartPrintJob(printJob%, True)
If lngResult Then
' look for window being closed
prtopen% = 1
Do While prtopen% <> 0
DoEvents
DoEvents
prtopen% = PEGetWindowHandle(printJob%)
Loop
End If
This is just a snippet, so look up the CR API reference to see how to declare the PE API and do loads more.
:cool:
-
I have never done anything like this, but have seen similar posts and hope I can point you in the right direction.
Try using the API call for getwindow to look at the crystal previewer window - http://www.vbapi.com/ref/g/getwindow.html
If a 0 is returned, this will tell you that it doesn't exist (or the window has been shut). You could do a loop, doevents, or a timer for every second to check if the window is till open, and if not to excecute your code.
I hope this helps you :)
-
Cheers both, Gerry's looks like the pucker way of handling the Crystal monster, so I'll dig around a bit.
Gerry how do you find the API info for Crystal? Is there a text file to use with API viewer for Crystal, cuz their help isn't the easiest to navigate around.
-
Hey guys,
I have a similar problem with my CR4.6
Which version of CR are you talking about?
Which version of CR do those API work for?
Thanks
-
I'm using CR8, I think the first CR API's appeared in V7. If you're using the OCX Seagate suggest the same sort of method that Alex gave (finding the handle of the viewer).
This article from Seagate gives the details
http://support.seagatesoftware.com/l...s/c2007707.asp
And is the path I've now gone down, in light of the fact that API stuff isn't my forte and the info doesn't exactly leap out of the help pages at me.
-
Anakim
Assuming you have the CRPE32.DLL from version 6 to 8
Send me your email address and I will send all the CRPE API stuff in two modules. This will allow all Crystal Report functions to be called. There is a couple of function in the modules with most of the common stuff being utilised.
Sorry the code is way too big for this forum!