-
I think this comes under the API juristiction.....
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. The help does mention API calls but these examples aren't in VB, and I'm far too much of a cabbage to figure out how to translate them!
-
You can use the IsWindow API on the Views Parent's WindowHandle property, i.e.
Code:
Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub cmdOpen_Click()
Set crwApp = CreateObject("Crystal.crpe.application")
Set crReport = crwApp.OpenReport("D:\DVD Ordering System\Reports\DVD002.rpt")
Set repView = crReport.Preview
While IsWindow(repView.Parent.WindowHandle)
DoEvents
Wend
MsgBox "Done"
End Sub
-
Ta
Thanks Aaron, I'd got some assistance on this from another thread. Think Seagate should add a nicer interface to their viewer to allow this without API's though!