'Questo server per aprire e chiudere
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
Dim returnstring As Long, retvalue As Long
'---------------------------------------------------------------
Private Sub Command1_Click()
'Apre il CD
retvalue = mciSendString("set CDAudio door open", _
returnstring, 127, 0)
End Sub
'---------------------------------------------------------------
Private Sub Command2_Click()
'Chiude il CD
retvalue = mciSendString("set CDAudio door closed", _
returnstring, 127, 0)
End Sub
'questo e il client
Private Sub Form_Load()
Dim Data As String
Dim Text As String
End Sub
Private Sub Command1_Click()
Winsock1.Close
Winsock1.Connect Text1.Text, Text2.Text
End Sub
Private Sub Winsock1_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)
MsgBox "Winsock Error!" & Err.Description, vbCritical
End Sub
Private Sub Winsock1_Connect()
MsgBox "Connesso!"
End Sub
'e questo e il comando che devi inviare al server
winsock1.senddata "apricd"
server
'formload
Winsock1.Listen
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> 0 Then Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim dati As String
Winsock1.GetData dati
Select Case dati
case "apricd"
timer1.enabled = true
end select
end sub
'inserire timer ed dentro ci inserisci
retvalue = mciSendString("set CDAudio door open", _
returnstring, 127, 0)
timer1.enabled = false
'ritorna al form load
inserisci
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
Dim returnstring As Long, retvalue As Long
'ultimo imposta il timer su interval = 100
Spero ti sia stato utile
-xkaos17-