steinie
10-09-2011, 15:34
I have opened a USB interface with COM and the send works fine.:p
I need a CallBack for the input.
Here is a short script, the first part works, just need callback.:neutral:
' AH COM GUI script created on 09-10-2011 07:30:05 by: JDS (ThinAIR)
Uses "Console"
Uses "UI"
Uses "COM" ' -- Create object
Dim Chndl As Long
Dim i As Single
Dim Params(7) As Variant
Dim RetVal As Variant
Chndl = Console_Alloc
Function TBMain()
DWord AHO = COM_CREATEOBJECT ("X10.ActiveHome", Params(7))
' -- Call method (parameters should be supplied in form of Variant array)
Params(1) = "sendplc"
Params(2) = "O09 on"
COM_CALLMETHOD(AHO, "SendAction", 2, Params(),RetVal)
Params(2) = "o09 off"
COM_CALLMETHOD(AHO, "SendAction", 2, Params(), RetVal)
While Time$
If GetAsyncKeyState(%VK_ESCAPE) Then Exit While
Wend
COM_RELEASE(AHO)
End Function
'---------------------------------------
CallBack Function AHO_RecvAction (ByVal bszRecv As Variant _
, ByVal vParm1 As Variant _
, ByVal vParm2 As Variant _
, ByVal vParm3 As Variant _
, ByVal vParm4 As Variant _
, ByVal vParm5 As Variant _
, ByVal vReserved As Variant) As Long 'Handles ActiveHomeObj.RecvAction
Console_WriteLine bszRecv
Console_WriteLine vParm1
Console_WriteLine vParm2
Console_WriteLine vParm3
Console_WriteLine vParm4
Console_WriteLine vParm5
Console_WriteLine vReserved
Console_WriteLine
End Function
Hope someone can help! Thanks
I need a CallBack for the input.
Here is a short script, the first part works, just need callback.:neutral:
' AH COM GUI script created on 09-10-2011 07:30:05 by: JDS (ThinAIR)
Uses "Console"
Uses "UI"
Uses "COM" ' -- Create object
Dim Chndl As Long
Dim i As Single
Dim Params(7) As Variant
Dim RetVal As Variant
Chndl = Console_Alloc
Function TBMain()
DWord AHO = COM_CREATEOBJECT ("X10.ActiveHome", Params(7))
' -- Call method (parameters should be supplied in form of Variant array)
Params(1) = "sendplc"
Params(2) = "O09 on"
COM_CALLMETHOD(AHO, "SendAction", 2, Params(),RetVal)
Params(2) = "o09 off"
COM_CALLMETHOD(AHO, "SendAction", 2, Params(), RetVal)
While Time$
If GetAsyncKeyState(%VK_ESCAPE) Then Exit While
Wend
COM_RELEASE(AHO)
End Function
'---------------------------------------
CallBack Function AHO_RecvAction (ByVal bszRecv As Variant _
, ByVal vParm1 As Variant _
, ByVal vParm2 As Variant _
, ByVal vParm3 As Variant _
, ByVal vParm4 As Variant _
, ByVal vParm5 As Variant _
, ByVal vReserved As Variant) As Long 'Handles ActiveHomeObj.RecvAction
Console_WriteLine bszRecv
Console_WriteLine vParm1
Console_WriteLine vParm2
Console_WriteLine vParm3
Console_WriteLine vParm4
Console_WriteLine vParm5
Console_WriteLine vReserved
Console_WriteLine
End Function
Hope someone can help! Thanks