OLE functions and properties

If you are a Power Builder developer and have any questions about using our products from Power Builder here is the place to post them.
Post Reply
tom3x
Posts: 1
Joined: Fri Aug 01 2008

OLE functions and properties

Post by tom3x »

I have following problem with ole object. I still get error error calling external property or function.I have tried 2 way of creating instances.First by automation pointer a second without it but then a get error null object referency.

Extract from programmer's guide:
Objects in SDK and their functions and properties are defined in type library.Type library is linked in pacsclnt.exe as a resource. SDK can use in every prog. languages which support OLE automation.

Example in VBscript:


Option Explicit

Dim bOK
Dim oPACS
Dim oStudiesManagement
Dim oStudiesInfoList
Dim oStudiesInfo
Dim oStudiesSeqID
Dim msg

' Create TomoCon PACS client object
Set oPACS = CreateObject("PACSClient.App")

' Set connection parameters
oPACS.PACSHostName = "pacs"
oPACS.PACSPortNumber = 104
oPACS.UserName = "PacsUser"
oPACS.UserPassword = "Password"

' Get studies management object
Set oStudiesManagement = oPACS.StudyManagement

' Find new studies
Set oStudiesInfoList = oStudiesManagement.GetNewStudiesInfo

msg = "Found " & oStudiesInfoList.Count & " new studies"
If oStudiesInfoList.Count > 0 Then
msg = msg & vbCRLF & "SeqID = " & oStudiesInfoList.SeqID
End If
MsgBox msg

' Display found study infos
Dim I
For I = 0 To oStudiesInfoList.Count-1

Dim sPatientName
Dim sPatientID
Dim sPatientSex
Dim sPatientBirthDate

Set oStudiesInfo = oStudiesInfoList.Item(I)

bOK = oStudiesInfo.GetPatientName(sPatientName)
bOK = oStudiesInfo.GetPatientID(sPatientID)
bOK = oStudiesInfo.GetPatientSex(sPatientSex)
bOK = oStudiesInfo.GetPatientBirthDate(sPatientBirthDate)


msg = "Study " & I+1 & " of " & oStudiesInfoList.Count & vbCRLF & _
vbCRLF & _
"Patient's name: " & sPatientName & vbCRLF & _
"Patient's birth date: " & sPatientBirthDate & vbCRLF & _
"Patient's sex: " & sPatientSex & vbCRLF & _

MsgBox msg
Next

If oStudiesInfoList.Count > 0 Then
Dim ret
ret = MsgBox("Delete new studies info?", vbYesNoCancel)
If ret = vbYes Then
oStudiesManagement.DeleteNewStudiesInfo(oStudiesInfoList.SeqID)
End If
End If


and my code in PB


Integer li_rc
String ls_pacshostname,ls_pacsportnumber,ls_pacsusername,ls_pacsuserpassword

ls_PacsHostName=f_fromdb_settings_sys ('PACS', 'PacsHostName', '')
ls_PacsPortNumber=f_fromdb_settings_sys ('PACS', 'PacsPortNumber', '')
ls_PacsUserName=f_fromdb_settings_sys ('PACS', 'PacsUserName', '')
ls_PacsUserPassword=f_fromdb_settings_sys ('PACS', 'PacsUserPassword', '')

OleObject oPACS
oPACS = Create OleObject
li_rc = oPACS.ConnectToNewObject ("PACSClient.App")
IF li_rc < 0 THEN
DESTROY oPACS
MessageBox("Connecting to COM Object Failed", &
"Error: " + String(li_rc))
Return
END IF

oPACS.PACSHostName=ls_PacsHostName
oPACS.PACSPortNumber=ls_PacsPortNumber
oPACS.UserName=ls_PacsUserName
oPACS.UserPassword=ls_PacsUserPassword

OleObject oStudiesManagement
oStudiesManagement = Create OleObject
oStudiesManagement.setautomationpointer(oPACS.StudyManagement)

OleObject oStudiesFilter
oStudiesFilter = Create OleObject
oStudiesFilter.setautomationpointer(oStudiesManagement.NewStudyFindFilter)

oStudiesFilter.SetPatientID(gch_rod_cis)

OleObject oStudiesInfoList
oStudiesInfoList = Create OleObject
oStudiesInfoList.setautomationpointer(oStudiesManagement.FindStudy(oStudiesFilter))
ls_pacsportnumber=string(oStudiesInfoList.Count) //error calling external property .Count or when i use /////oStudiesInfoList=oStudiesManagement.FindStudy(oStudiesFilter) null object referency

Messagebox('',ls_pacsportnumber)


To wit I dont know it's possible to do it in PB7 but programmer's guide writes exactly 'SDK can use in every prog. languages which support OLE automation.' so it would be...

Thanks for help.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: OLE functions and properties

Post by Joan »

Hello,

Are you using the PDF Creator or the PDF Converter?

In your below code I didn't see where you are creating an instance of the PDF Converter or the PDF Creator dll.

Best Regards
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
Post Reply