I just read the tutorial for creating your own plugin, and the example works fine (I program in VB.NET).
I want to develop a plugin so that MP can communicate with a device using the ethernet protocol ModbusTCP.
I have an ActiveX for the ModbusTCP communication.
How can I call that ActiveX when a button in MP is pressed to activate a lamp,....
I try to put the ommand under ButtonOne but it doesn't work. The dialog doesn't appear.
The code for the communication is correct because this works as EXE.
Private Sub OnButtonOne()
klant = New System.Net.Sockets.TcpClient(address, port)
master = Modbus.Device.ModbusIpMaster.CreateTcp(klant) ''activeX
Dim numInputs, startAddress As UShort
Dim inputs(3) As UShort
numInputs = 2
startAddress = 51
inputs = master.ReadHoldingRegisters(1, startAddress, numInputs)
tekst = CStr(inputs(0))
Dim dlg As GUIDialogOK = CType(GUIWindowManager.GetWindow(CType(GUIWindow.Window.WINDOW_DIALOG_OK, Integer)), GUIDialogOK)
dlg.SetHeading("Button has been pressed")
dlg.SetLine(1, tekst)
dlg.SetLine(2, String.Empty)
dlg.SetLine(3, String.Empty)
dlg.DoModal(GUIWindowManager.ActiveWindow)
End Sub
Have I to use the ActiveX in another way.
Regards.
I want to develop a plugin so that MP can communicate with a device using the ethernet protocol ModbusTCP.
I have an ActiveX for the ModbusTCP communication.
How can I call that ActiveX when a button in MP is pressed to activate a lamp,....
I try to put the ommand under ButtonOne but it doesn't work. The dialog doesn't appear.
The code for the communication is correct because this works as EXE.
Private Sub OnButtonOne()
klant = New System.Net.Sockets.TcpClient(address, port)
master = Modbus.Device.ModbusIpMaster.CreateTcp(klant) ''activeX
Dim numInputs, startAddress As UShort
Dim inputs(3) As UShort
numInputs = 2
startAddress = 51
inputs = master.ReadHoldingRegisters(1, startAddress, numInputs)
tekst = CStr(inputs(0))
Dim dlg As GUIDialogOK = CType(GUIWindowManager.GetWindow(CType(GUIWindow.Window.WINDOW_DIALOG_OK, Integer)), GUIDialogOK)
dlg.SetHeading("Button has been pressed")
dlg.SetLine(1, tekst)
dlg.SetLine(2, String.Empty)
dlg.SetLine(3, String.Empty)
dlg.DoModal(GUIWindowManager.ActiveWindow)
End Sub
Have I to use the ActiveX in another way.
Regards.