Results 1 to 3 of 3

Thread: Trap 'close' in Crystal viewer?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101
    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!
    Anakim

    It's a small world but I wouldn't like to paint it.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Smile 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!
    Anakim

    It's a small world but I wouldn't like to paint it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width