muchas gracias a todos.
saludos
saludos
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúOption Explicit
Private Declare Function APIBeep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
Dim frecuencia As Long
frecuencia = CLng(text1.Text)
APIBeep frecuencia, 500
End Sub
winsock1.getdata coordenadas, vbstring
setcursorpos val(ok(0)), val(ok(1))
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Command1_Click()
On Error GoTo s
Winsock1.Connect Text1.Text, Text2.Text
Exit Sub
s:
Winsock1.Close
MsgBox Error(Err), vbCritical, Error
End Sub
Private Sub Command2_Click()
Winsock1.Close
End Sub
Private Sub Command3_Click()
Timer2.Enabled = True
Picture1.Picture = LoadPicture("C:\verde.jpg")
End Sub
Private Sub Command4_Click()
Timer2.Enabled = False
Picture1.Picture = LoadPicture("c:\rojo.jpg")
End Sub
Private Sub Form_Load()
Winsock1.Close
Timer1_Timer
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End Sub
Private Sub Text3_Change()
Dim cx As String
cx = Text3.Text
Winsock1.SendData cx
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text4_Change()
Dim cy As String
cy = Text3.Text
Winsock1.SendData cy
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Timer2_Timer()
Dim Posicion As POINTAPI
GetCursorPos Posicion
Text3.Text = Posicion.X
Text4.Text = Posicion.Y
End Sub
Private Sub Winsock1_Close()
MsgBox "Socket cerrado"
End Sub
Private Sub Winsock1_Connect()
MsgBox "Conexion realizada"
End Sub
Private Sub Timer1_Timer()
estado = Winsock1.State
Select Case estado
Case 0
sb.Panels(1).Text = "Desconectado"
Case 1
sb.Panels(1).Text = "Abierto"
Case 2
sb.Panels(1).Text = "Escuchando..."
Case 3
sb.Panels(1).Text = "Pendiente"
Case 4
sb.Panels(1).Text = "Resolviendo Host..."
Case 5
sb.Panels(1).Text = "Host Resuelto"
Case 6
sb.Panels(1).Text = "Conectando..."
Case 7
sb.Panels(1).Text = "Conectado"
Case 8
sb.Panels(1).Text = "Conexion Cerrada"
Case 9
sb.Panels(1).Text = "Error"
End Select
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 "Numero: " & Number & " - Descripcion: " & Description, vbCritical, "Error critico"
Winsock1.Close
End Sub
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End Sub
Private Sub textx_Change()
Dim x As String
x = Textx
y = Texty
SetCursorPos x, y
End Sub
Private Sub Textx_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub texty_Change()
Dim y As String
y = Texty
x = Textx
SetCursorPos x, y
End Sub
Private Sub Texty_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Timer1_Timer()
Dim estado As String
estado = Winsock1.State
Select Case estado
Case 0
sb.Panels(1).Text = "Desconectado"
Case 1
sb.Panels(1).Text = "Puerto abierto"
Case 2
sb.Panels(1).Text = "Acepta solicitud"
Case 3
sb.Panels(1).Text = "Conexion pendiente"
Case 4
sb.Panels(1).Text = "Problema con el Host"
Case 5
sb.Panels(1).Text = "Problema resuelto"
Case 6
sb.Panels(1).Text = "Conectando"
Case 7
sb.Panels(1).Text = "Conectado"
Case 8
sb.Panels(1).Text = "Cerrando conexion"
Case 9
sb.Panels(1).Text = "Error"
End Select
End Sub
Private Sub Timer2_Timer()
Picture1.Picture = LoadPicture("C:\rojo.jpg")
End Sub
Private Sub Winsock1_Close()
MsgBox "Socket cerrado"
End Sub
Private Sub Winsock1_Connect()
MsgBox "Conexion realizada"
End Sub
Private Sub Form_Load()
Winsock1.Listen
Text1.Text = Winsock1.LocalIP & ":" & Winsock1.LocalPort
Timer1_Timer
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim cx, cy As String
Winsock1.GetData cx
Winsock1.GetData cy
Textx.Text = cx
Texty.Text = cy
Picture1.Picture = LoadPicture("C:\verde.jpg")
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 "Numero: " & Number & " - Descripcion: " & Description, vbCritical, "Error critico"
End Sub