Envoi Image par winsock

wawamule Messages postés 13 Date d'inscription mardi 4 octobre 2005 Statut Membre Dernière intervention 8 juin 2006 - 7 mai 2006 à 15:19
robapt Messages postés 114 Date d'inscription mardi 6 juillet 2004 Statut Membre Dernière intervention 4 décembre 2009 - 7 mai 2006 à 15:56
Bonjour j'ai une relation client - serveur établie à l'aide de de composant winsock afin de transférer un screenshoot du client au serveur mais je ne parviens a l'envoyer pouvez-vous regarder mon code et me dire qu'elle est mon erreur s'il vous plait, j'utilise le SSHOT8514 pour la capture d'écran

Voici le code Serveur :
La form est composée de 2 bouton command, 1 zone pour l'image, un fichier text pour retourner votre ip et un composant winsock.

Private Sub Command1_click()
Winsock1.Close
Winsock1.Connect Text1.Text, 10003


End Sub
Private Sub command2_Click()
Winsock1.SendData "EnvoiImage"
End Sub


Private Sub Form_Load()
Text1.Text = Winsock1.LocalIP
End Sub


Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Winsock1.GetData data
If Image1.Picture = "" Then
Image1.Picture = data
End If
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub

Et le code du client qui lui est composer d'un winsock et d'une zone pour afficher la capture réalisée :

Private Declare Function sshot Lib "SSHOT8514" (ByVal chemin As String, ByVal typeimage As String, ByVal qualite As Integer, ByVal xdim As Integer, ByVal ydim As Integer) As Integer
Dim retour As Integer





Private Sub Form_Load()
Winsock1.LocalPort = 10003
Winsock1.Close
Winsock1.Listen
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 tmpData As String
Winsock1.GetData tmpData
Select Case tmpData
Case "EnvoiImage"
EnvoiImage
End Select
End Sub


Function EnvoiImage()


retour = sshot(App.Path & "\resultat.jpg", "jpg", 100, 800, 600)
Form1.ImagePcDistante.Picture = LoadPicture(App.Path & "\resultat.jpg")
Winsock1.SendData ImagePcDistante


End Function

Pourriez-vous me répondre assez rapidement car il s'agit d'une partie de mon travail de fin d'études.

2 réponses

robapt Messages postés 114 Date d'inscription mardi 6 juillet 2004 Statut Membre Dernière intervention 4 décembre 2009
7 mai 2006 à 15:49
Slt, moi aussi pour un prog avec capture d'écran ,j'ai eu du mal ,mais va voir cette source jai réussi grace à a celle-ci

http://www.vbfrance.com/codes/ENVOYER-IMAGE-WINSOCK_6791.aspx

Tu as juste tout a recopier le code et modifier quelque truc

Bonne chance
0
robapt Messages postés 114 Date d'inscription mardi 6 juillet 2004 Statut Membre Dernière intervention 4 décembre 2009
7 mai 2006 à 15:56
si tu ve je peut tenvoyer ma source ,je l'ai fini ce matin (coincidence ^^)
0
Rejoignez-nous