CR 8.0 API PEOutputToWindow (LONG) 
Author Message
 CR 8.0 API PEOutputToWindow (LONG)

Hi to all.
I use the following code to open the print preview window of crystal
reports. I use directly the API calls.
I have copy&paste the CR help files examples but the print preview window
never open.
Here is the code:

Public Sub subCaricaReport(strFileReport As String, MyRPT As itRPT_Engine)

    Dim intPEOpenRes As Integer
    Dim intJobNum As Integer
    Dim intResult As Integer

    intPEOpenRes = PEOpenEngine()
[...]
    ' Apro un job sul report passatomi;
    intJobNum = PEOpenPrintJob(strFileReport)
[...]

    Dim TableType As PETableType
    Dim LogOnInfo As PELogOnInfo
    Dim TableLocation As PETableLocation
    Dim SessionInfo As PESessionInfo

    Dim TestTableType As PETableType
    Dim TestLogOnInfo As PELogOnInfo
    Dim TestTableLocation As PETableLocation
    Dim TestSessionInfo As PESessionInfo

    Dim TableCount As Integer

    TableType.StructSize = PE_SIZEOF_TABLE_TYPE
    LogOnInfo.StructSize = PE_SIZEOF_LOGON_INFO
    TableLocation.StructSize = PE_SIZEOF_TABLE_LOCATION
    SessionInfo.StructSize = PE_SIZEOF_SESSION_INFO

    TestTableType.StructSize = PE_SIZEOF_TABLE_TYPE
    TestLogOnInfo.StructSize = PE_SIZEOF_LOGON_INFO
    TestTableLocation.StructSize = PE_SIZEOF_TABLE_LOCATION
    TestSessionInfo.StructSize = PE_SIZEOF_SESSION_INFO

    TableCount = PEGetNTables(intJobNum)
[...]

    Dim i As Integer

    For i = 0 To TableCount - 1
        intResult = PEGetNthTableType(intJobNum, i, TableType)
[...]
        intResult = PEGetNthTableLogOnInfo(intJobNum, 0, LogOnInfo)
[...]
        intResult = PEGetNthTableLocation(intJobNum, i, TableLocation)
[...]

        intResult = PEGetNthTableSessionInfo(intJobNum, i, SessionInfo)
[...]
        LogOnInfo.ServerName = App.Path & "\Example\Datavuoto2002.mdb" &
Chr$(0)

        intResult = PESetNthTableLogOnInfo(intJobNum, i, LogOnInfo, True)
[...]
    Next i

    intResult = PEOutputToWindow(intJobNum, "Anteprima di stampa" & Chr$(0),
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0,
MyRPT.OwnerForm.hWnd)
[...]

    intResult = PEStartPrintJob(intJobNum, 1)
[...]

    Dim lngTemp As Long
    lngTemp = 1
    Do While lngTemp <> 0

        lngTemp = PEGetWindowHandle(intJobNum)
        DoEvents
        DoEvents
        DoEvents
    Loop

    PEClosePrintJob intJobNum

    PECloseEngine

[...]
End Sub

I suppose that seagate's programmers use the last do...while to wait for the
print preview window close. The PEGetWindowHandle API return me always a
non-zero value (so I suppose that the window is created) but the preview
window isn't displayed. Why?
After each API call I use a ErrorTrap function that check if an error occour
and the execution of each API is OK.
If anyone have a valid example...

Best Regards

SebaMix

P.S. Sorry my english :-)



Sat, 18 Sep 2004 17:37:16 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. CR Enterprise 8.0 - Cannot login CR console

2. Using a dll that referenced CR 8.5 files on a machine that has CR 8.0

3. vb6 sp5 in xp pro and cr 8.0

4. Native driver for Oracle 8 in CR 8.5 and CE 8.0

5. Has Anyone Upgraded from CR 8.0 to 8.5?

6. CR 8.0 Crash "SetDataSource"-Method

7. CR 8.0 with MS SQL Server - database changing

8. Starting a CR(8.0) out of VB.NET application

9. Starting a CR (8.0) out of VB (6.0) application

10. French DLLs for CR 8.0

11. Cr 8.0 : Class not registered

12. CR 8.0 Keycode

 

 
Powered by phpBB® Forum Software