I have found many bits of source code to send info to the LCD display, but none to get the display and place it in a textbox. the source code is below,
this will let you send data to the display, but not get the LCD status.
please can you help, i really have no idea how to do this?
Regards
Richard
Code:
Private Sub HPDisplay(RHost As String, Message As String)
'Dim wSock ' declare a object
Dim i ' idem
Dim TempTimer As Double
'Set wSock = CreateObject("mswinsock.winsock") ' create the winsock socket
wSock.RemoteHost = RHost '"149.160.31.105"
wSock.RemotePort = "9100"
wSock.Connect
TempTimer = Timer
While (wSock.State <> 7)
If wSock.State = 0 Or Timer > TempTimer + 3 Then
wSock.Close
Cls
Print "Network name " & RHost & " not found"
Exit Sub
End If
DoEvents
Wend
wSock.SendData (Chr(27) & "%-12345X@PJL RDYMSG DISPLAY = " & Chr(34) & Message & Chr(34) & vbCrLf)
wSock.SendData (Chr(27) & "!%-12345X" & vbCrLf)
Sleep 1
wSock.Close
End Sub
Sub Sleep(s As Double)
Dim t As Double
t = Timer
Do
DoEvents
Loop Until Timer > t + s
End Sub
Private Sub Form_Load()
Call GetPrinters
End Sub
Private Sub Form_Resize()
PrinterList.Width = MainForm.Width - 350
PrinterList.Height = MainForm.Height - 1450
End Sub
Private Sub IPTxt_Change()
'If IPTxt.Text = "" Then
' PrinterList.Enabled = True
'Else
' PrinterList.Enabled = False
'End If
End Sub
Private Sub MessageTxt_Change()
If Len(MessageTxt.Text) > 16 Then MessageTxt.Text = Left(MessageTxt.Text, 16)
End Sub
Private Sub RunBut_Click()
If IPTxt.Text <> "" Then Call HPDisplay(IPTxt.Text, MessageTxt.Text)
For i = 0 To PrinterList.ListCount - 1
If PrinterList.Selected(i) Then Call HPDisplay(Right(PrinterList.List(i), Len(PrinterList.List(i)) - 45), MessageTxt.Text)
Next
MsgBox "Done Sending Messages to Display(s)"
End Sub
Private Sub GetPrinters()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")
For Each objPrinter In colInstalledPrinters
PrinterList.AddItem objPrinter.Name & Space(40 - Len(objPrinter.Name)) & "Port:" & objPrinter.PortName
Next
End Sub
Private Sub SelectAllBut_Click()
For i = 0 To PrinterList.ListCount - 1
PrinterList.Selected(i) = True
Next
End Sub
Private Sub UrlLab_Click()
Shell "explorer http://www.irongeek.com"
End Sub
please can you help, i really have no idea how to do this?
Regards
Richard