BroadCast




Const BROADCASTPORT = 1055
'API Call which drives the Hyperlink

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Sub HyperJump(ByVal URL As String)
'Function to execute the Hyperlink

Call ShellExecute(0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus)
End Sub

Private Sub cmdBroadcast_Click()
'Broadcast the data in txtData

'Ignore error 126 which sometimes occurs

On Error GoTo ErrorHandler
udpBroadcast.SendData txtData.Text
Exit Sub

ErrorHandler:
If Err.Number <> 126 Then
MsgBox Err.Description, vbCritical, Err.Number
End If
Resume Next

End Sub

Private Sub Form_Load()
'Set up the Winsock control

With udpBroadcast
.Protocol = sckUDPProtocol
.LocalPort = BROADCASTPORT
.RemotePort = BROADCASTPORT
.RemoteHost = "255.255.255.255" ' This is the broadcast IP
End With
End Sub

Private Sub lblEmail_Click()
'Activate the default e-mail client

HyperJump lblEmail.Tag
End Sub

Private Sub lblWebsite_Click()
'Activate the hyperlink

HyperJump lblWebsite.Tag
End Sub

Private Sub udpBroadcast_DataArrival(ByVal bytesTotal As Long)
Dim IncomingData As String
'Data has arrived so display it

udpBroadcast.GetData IncomingData
txtReceived.Text = IncomingData
End Sub

Private Sub udpBroadcast_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
'An error has occurred so display a description

MsgBox Err.Description, vbCritical, Err.Source
End Sub

Const BROADCASTPORT = 1055
'API Call which drives the Hyperlink

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Sub HyperJump(ByVal URL As String)
'Function to execute the Hyperlink

Call ShellExecute(0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus)
End Sub

Private Sub cmdBroadcast_Click()
'Broadcast the data in txtData

'Ignore error 126 which sometimes occurs

On Error GoTo ErrorHandler
udpBroadcast.SendData txtData.Text
Exit Sub

ErrorHandler:
If Err.Number <> 126 Then
MsgBox Err.Description, vbCritical, Err.Number
End If
Resume Next

End Sub

Private Sub Form_Load()
'Set up the Winsock control

With udpBroadcast
.Protocol = sckUDPProtocol
.LocalPort = BROADCASTPORT
.RemotePort = BROADCASTPORT
.RemoteHost = "255.255.255.255" ' This is the broadcast IP
End With
End Sub

Private Sub lblEmail_Click()
'Activate the default e-mail client

HyperJump lblEmail.Tag
End Sub

Private Sub lblWebsite_Click()
'Activate the hyperlink

HyperJump lblWebsite.Tag
End Sub

Private Sub udpBroadcast_DataArrival(ByVal bytesTotal As Long)
Dim IncomingData As String
'Data has arrived so display it

udpBroadcast.GetData IncomingData
txtReceived.Text = IncomingData
End Sub

Private Sub udpBroadcast_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
'An error has occurred so display a description

MsgBox Err.Description, vbCritical, Err.Source
End Sub











( broadcast.html )- by Paolo Puglisi - Modifica del 17/12/2023