elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  OCX
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: OCX  (Leído 1,759 veces)
mardek

Desconectado Desconectado

Mensajes: 12


Ver Perfil
OCX
« en: 8 Agosto 2010, 01:55 am »

Hola que tal. Gracias por ingresar. Les comento mi problema. Yo tengo hecho un programa, que todo va bien pero cuando lo pruebo en otra pc salta el error del Winsock. Busque en internet y vi que tenia que usar el CsocketMaster, lo configuro todo tal cual es pero ahora no me conecta ni en modo de ejecucion. Quisiera saber si alguien me puede ayudar a poder hacerlo andar bien.

Codigo Cliente:

Código
  1. Private Sub Command1_Click()
  2.    On Error GoTo ssig:
  3.    With Winsock1:
  4.                    .Close
  5.                    .RemotePort = Val(Text2.Text)
  6.                    .RemoteHost = Text1.Text
  7.                    .Connect
  8.    End With
  9.    If Winsock1.State <> 7 Then
  10.        Caption = "Desconectado"
  11.    Else
  12.        Caption = "Conectado"
  13.    Exit Sub
  14. ssig:
  15.    MsgBox Err.Description, vbCritical + vbOKOnly, Err.Source
  16.    Err.Clear
  17.    End If
  18. End Sub
  19.  
  20. Private Sub Command3_Click()
  21.    Text3.Text = Text3.Text & vbCrLf & "-->" & Text4.Text
  22.    Winsock1.SendData "Cliente --> " & Text4.Text
  23. End Sub
  24.  
  25. Private Sub Form_Load()
  26.    Form2.Hide
  27.    Command3.Enabled = False
  28. End Sub
  29.  
  30. Private Sub PaneldeControl_Click()
  31. Form2.Show
  32. End Sub
  33.  
  34. Private Sub Salir_Click()
  35. End
  36. End Sub
  37.  
  38. Private Sub Text4_KeyPress(KeyAscii As Integer)
  39. If KeyAscii = 13 Then Command3_Click
  40. End Sub
  41.  
  42. Private Sub Winsock1_Close()
  43. Caption = "Desconectado"
  44.    Command3.Enabled = False
  45. End Sub
  46.  
  47. Private Sub Winsock1_connect()
  48. Caption = "Conectado"
  49.    Command3.Enabled = True
  50. End Sub
  51.  
  52. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  53. Dim datos As String
  54. Winsock1.GetData datos, vbString
  55. Text3 = Text3 & vbCrLf & datos
  56. End Sub
  57.  
  58. 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)
  59.    Caption = "Error"
  60.    Err.Clear
  61. End Sub
  62.  

Codigo Servidor:

Código
  1. Option Explicit
  2. Dim WithEvents Winsock1 As CSocketMaster
  3.  
  4. Private Sub Command1_Click()
  5.    Text1.Text = Text1.Text & vbCrLf & "-->" & Text2.Text
  6.    Winsock1.SendData "Servidor --> " & Text2.Text
  7. End Sub
  8.  
  9. Private Sub Form_Load()
  10. Set Winsock1 = New CSocketMaster
  11.    With Winsock1
  12.            .CloseSck
  13.            .LocalPort = 4576
  14.            .Listen
  15.    End With
  16. End Sub
  17.  
  18. Private Sub Text2_KeyPress(KeyAscii As Integer)
  19.    If KeyAscii = 13 Then Command1_Click
  20. End Sub
  21.  
  22. Private Sub Winsock1_CloseSck()
  23. Caption = "Desconectado"
  24. End Sub
  25.  
  26. Private Sub Winsock1_Connect()
  27. Caption = "Conectado"
  28. End Sub
  29.  
  30. Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
  31.    Winsock1.CloseSck
  32.    Winsock1.Accept requestID
  33.    If Winsock1.State <> 7 Then: Caption = "Desconectado": Else: Caption = "Conectado"
  34. End Sub
  35.  
  36. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  37.    Dim datos As String
  38.    Winsock1.GetData datos, vbString
  39.    Text1 = Text1 & vbCrLf & datos
  40. End Sub
  41.  
  42. 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)
  43.    Caption = "Error"
  44. End Sub
  45.  
  46. Private Sub Text1_Change(): Text1.SelStart = Len(Text1.Text): End Sub
  47.  

Muchas Gracias por atender mi problema
Que tengan un buen dia!


En línea

seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: OCX
« Respuesta #1 en: 8 Agosto 2010, 02:09 am »

pues simplemente tenes que copiar ese ocx en la maquina donde te salta el error.


En línea

Fitoschido

Desconectado Desconectado

Mensajes: 248



Ver Perfil WWW
Re: OCX
« Respuesta #2 en: 8 Agosto 2010, 06:40 am »

Copiarlo y registrarlo! :D

Abrir símbolo de sistema como administrador y...

Código
  1. regsvr32 "C:\Windows\System32\MiOCXejemplo.ocx"
En línea

El que sabe hace, el que no enseña


Miembro oficial del proyecto Ubuntu, traductor de LibreOffice/Ubuntu/Xfce/Gnome.
mardek

Desconectado Desconectado

Mensajes: 12


Ver Perfil
Re: OCX
« Respuesta #3 en: 9 Agosto 2010, 00:27 am »

Ok muchas Gracias a los dos por responder. Voy a probarlo
Saludos

EDITO

Al final anduvo con lo que me dijeron..
Gracias a los dos!
Saludos
« Última modificación: 10 Agosto 2010, 00:22 am por mardek » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines