how to convert this vba code to bmx ?
BlitzMax Forums/BlitzMax Programming/how to convert this vba code to bmx ?
| ||
Imports ActiveHomeScriptLib Imports System Module Module1 Dim WithEvents ActiveHomeObj As ActiveHome <MTAThread()> Sub Main() 'create ActiveHome object Try ActiveHomeObj = CreateObject("X10.ActiveHome") Catch exc As Exception Console.WriteLine("err num: " & Str(Err.Number) & " '" & exc.ToString & "'") Finally End Try 'send a1 on Try ActiveHomeObj.SendAction("sendplc", "a10 on") Catch exc As Exception Console.WriteLine("err num: " & Str(Err.Number) & " '" & exc.ToString & "'") Finally End Try 'wait for events Dim nRead While True System.Threading.Thread.Sleep(0) nRead = Console.Read() End While End Sub 'events from ActiveHome: write out received event Sub ActiveHome_RecvAction(ByVal bszRecv As Object _ , ByVal vParm1 As Object _ , ByVal vParm2 As Object _ , ByVal vParm3 As Object _ , ByVal vParm4 As Object _ , ByVal vParm5 As Object _ , ByVal vReserved As Object) Handles ActiveHomeObj.RecvAction Console.WriteLine("RecvAction: " & bszRecv & " " & vParm1 & " " & vParm2 & " " & vParm3 & " " & vParm4 & " " & vParm5) End Sub ps : the ActiveHomeScriptLib is a dll ( ActiveHomeScriptLib.dll) thanks for help. |
| ||
Find the definitions for the functions inside the dll you are trying to use. Then load the library and its function pointers, pay attention to the data types in VB when converting them. IIRC pretty much all the standard data types are the same in Max and VB. There should be some type of list in visual studio that allows you to view all the functions inside ActiveHomeScriptLib.dll; look for it. |