COM Byval/Brref - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

COM Byval/Brref

I included PASSBRIDGELib COM Object using Tools -> References

I wrote VB code as follows:

[code]
'PASSBridge Objects
Dim PB_Manager As PASSBRIDGELib.manager
Dim PB_Serial As PASSBRIDGELib.com_serial



Sub PB_Send(ByVal y As Byte)
PB_Send = PB_Serial.send(y)
End Sub


Private Sub cmdSend_Click() ' the name of command button is cmdSend
Dim lResult As Long
Dim index As Byte
upperLimit = UBound(y)
For index = 0 To upperLimit
Dim myVar As Byte
myVar = y(index)
lResult = PB_Serial.send(myVar)
Next
End Sub

'Passbridge COM Object
Private Sub Form_Load()


' Create COM Objects
Set PB_Manager = CreateObject("passbridge.manager")
Set PB_Serial = CreateObject("passbridge.com_serial")

End Sub


[/code]



When I try to compile the code and click on command button 'cmdSend' I get an error:
[red]
Compile error:
Function or interface marked as restricted, or the function uses an automation type not supported in Visual basic
[/red]

The COM Object Passbridge has a member 'send' in class COM_VARIABLE.
When we view the object property using Object browser we get

[code]
Function send(newVal() As Byte) As Long
Member of PASSBRIDGELib.com_serial
method send
[/code]


'send' is a function to which we have to pass only byVal.
Please can you help me solve this bug?


Comments

  • softrickssoftricks Posts: 24Member
    : I included PASSBRIDGELib COM Object using Tools -> References
    :
    : I wrote VB code as follows:
    :
    : [code]
    : 'PASSBridge Objects
    : Dim PB_Manager As PASSBRIDGELib.manager
    : Dim PB_Serial As PASSBRIDGELib.com_serial
    :
    :
    :
    : Sub PB_Send(ByVal y As Byte)
    : PB_Send = PB_Serial.send(y)
    : End Sub
    :
    :
    : Private Sub cmdSend_Click() ' the name of command button is cmdSend
    : Dim lResult As Long
    : Dim index As Byte
    : upperLimit = UBound(y)
    : For index = 0 To upperLimit
    : Dim myVar As Byte
    : myVar = y(index)
    : lResult = PB_Serial.send(myVar)
    : Next
    : End Sub
    :
    : 'Passbridge COM Object
    : Private Sub Form_Load()
    :
    :
    : ' Create COM Objects
    : Set PB_Manager = CreateObject("passbridge.manager")
    : Set PB_Serial = CreateObject("passbridge.com_serial")
    :
    : End Sub
    :
    :
    : [/code]
    :
    :
    :
    : When I try to compile the code and click on command button 'cmdSend' I get an error:
    : [red]
    : Compile error:
    : Function or interface marked as restricted, or the function uses an automation type not supported in Visual basic
    : [/red]
    :
    : The COM Object Passbridge has a member 'send' in class COM_VARIABLE.
    : When we view the object property using Object browser we get
    :
    : [code]
    : Function send(newVal() As Byte) As Long
    : Member of PASSBRIDGELib.com_serial
    : method send
    : [/code]
    :
    :
    : 'send' is a function to which we have to pass only byVal.
    : Please can you help me solve this bug?
    :
    :
    :
    '--------------------------------------------------->>>>>>>>>
    Hi,
    you can find your request at www.softricks.5u.com
Sign In or Register to comment.