cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal XI and GetVersion

patrick_simons2
Participant
0 Kudos

I recently installed Crystal Reports XI R2 SP5; before I used CR9 SP7.

I'm programming with VB6 SP6 und CR RDC.

When using the function "CRAXDRT.Application.GetVersion()" which should give me the version of craxdrt.dll, I always get the version 9.00 instead of 11.5 (after converting it to hex...).

I'm sure that the correct DLL is referenced by the VB-project.

Or is there another possibility to get the actual CR-version used?

Any ideas?

Patrick

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Patrick;

This has been broken since verison 9. A work around is to use the file version. See the following note:

[Version|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313337333633373337%7D.do]

Regards,

Jonathan

patrick_simons2
Participant
0 Kudos

Ok I tried to continue my research.

In my VB6-app I create an instance of CR.

Set oCRXApp = New CRAXDRT.Application

Using the ProgID "CrystalRuntime.Application" I can find via CLSID the filelocation "C:\Program Files\Business Objects\Common\3.5\bin\craxdrt.dll" and with the API GetFileVersionInfo() its version. This works.

    Dim sClsID As String
    Dim sPathFile As String
    
    sClsID = ProgIdToCLSID("CrystalRuntime.Application")
    Debug.Print "CLSID = " & sClsID
    
    If GetKeyValue(HKEY_CLASSES_ROOT, "CLSID\" & Trim$(sClsID) & "\InProcServer32", "", sPathFile) Then
        Debug.Print "File = " & sPathFile
        
        Dim lSize As Long, lPointer As Long, lBufLen As Long
        Dim yBuff() As Byte
        Dim tVersion As VS_FIXEDFILEINFO
        Dim sVersion As String

        lSize = GetFileVersionInfoSize(sPathFile, 0&)
        If lSize < 1 Then
            MsgBox "No Info!"
        Else
            ReDim yBuff(lSize)
            Call GetFileVersionInfo(sPathFile, 0&, lSize, yBuff(0))
            Call VerQueryValue(yBuff(0), "\", lPointer, lBufLen)
            Call MoveMemory(tVersion, lPointer, Len(tVersion))
            
            With tVersion
                sVersion = Format$(.dwProductVersionMSh) & "." & _
                            Format$(.dwProductVersionMSl) & "." & _
                            Format$(.dwProductVersionLSh) & "." & _
                            Format$(.dwProductVersionLSl)
            End With
            Debug.Print "Version " & sVersion
        End If
    End If

But on my PC I have installed CR 9 and CR XI. So in my Registry I have 3 ProgIDs:

- "CrystalRuntime.Application"

- "CrystalRuntime.Application.9"

- "CrystalRuntime.Application.11"

How can I make a relation between the CR-object used in VB6 and the ProgID.

Any ideas?

Patrick

former_member183750
Active Contributor
0 Kudos

In a nut shell, the code would be:

Set CrystalApplication = CreateObject("CrystalRuntime.Application";)

Set CrystalReport = CrystalApplication.OpenReport("C:\Temp\TestReport.rpt";)

CRViewer1.ReportSource = CrystalReport

CRViewer1.ViewReport

But you do not need to do this in code. You should be able to reference the craxdrt.dll in your VB 6 project by going to the Project menu and selecting references. Craxdrt.dll of version 11.0 will be noted as "Crystal ActiveX Designer Run Time Library 11.0";.

Ludek

patrick_simons2
Participant
0 Kudos

I understand, but with your ProgID "CrystalRuntime.Application" you can't be sure that VB takes the 11.5 version! (I made the test) Because I use early-binding, I set the VB reference to 11.5. So my question was: when I set this reference to VB, how can I programatically see what ProgID to use?

Patrick

Answers (0)