Results 1 to 7 of 7

Thread: Trap 'close' event

  1. #1

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

    Question


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

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

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    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.

    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    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

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  4. #4

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

    Anakim

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

  5. #5
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Talking

    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

  6. #6

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

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

  7. #7
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    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!

    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

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