4 Replies - 2842 Views - Last Post: 30 August 2012 - 10:42 AM Rate Topic: -----

#1 flameneo  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 19-August 12

loading a profile pixture using winsock control vb6.0

Posted 27 August 2012 - 12:48 PM

Hey. I am having trouble with winsock control. i am working on a chat program, i'll like to upload a profile picture to make the chat 4n, but i just cant get it to work. this is what i have done so far


Private Sub CMDPIX_CLICK()
Dim PROPIX As PictureBox
On Error Resume Next
PRO.ShowOpen
txtPRO.Text = PRO.FileName
Image2 = LoadPicture(txtPRO.Text)
PROPIX.Picture = Image2.Picture

Image3.Picture = PROPIX


End Sub


Private Sub WINSOCK1_DATAARRIVAL(Index As Integer, ByVal BYTESTOTAL As Long)
    
    'ERROR CODE
    On Error GoTo BOOBOO 'A NO-NO HAPPEND
    
    'STRING FOR RECEIVING DATA
    Dim INCOMING As String
    
    'STRING - WHAT TO DO.
    Dim STRCUT As String
    
    'TEMP INDEX
    Dim I As Integer
    
    'RECIEVE INCOMING STRING OVER NET.
    Winsock1(Index).GetData INCOMING, vbString, BYTESTOTAL
    
    'CUT OFF THE INSTRUCTION PART.
    CUTSTRING STRCUT, INCOMING
    
    'FIND OUT WHAT THEY WANT.
    Select Case STRCUT
        Case "PRINT"
            If BLNSECURE And INTACCESS(Index) < 1 Then
                If INCOMING = STRPASSWORD Or INCOMING = vbCrLf & STRPASSWORD Then
                    SENDCONNECTIONS Index 'SEND MY INFO &
                    INTACCESS(Index) = 1 'ACCEPT CONNECTION.
                Else
                    INTACCESS(Index) = INTACCESS(Index) - 1
                    SENDTOONE Index, "PRINT,PASSWORD INVALID. TRY AGAIN:"
                    If INTACCESS(Index) <= -INTSTRIKES Then
                        PASSWORDFAILED Index
                    End If 'INTACCESS
                End If 'INCOMING
            Else
                GETSENDERSINFO Index
                If Not PASSIVE Then
                
                
                    txtOutput.Text = txtOutput.Text & vbCrLf & lblTime.Caption & ":  " & STRNAME + ": " & INCOMING
                    Image2 = Image2
       txtOutput.SelStart = Len(txtOutput.Text)
                    txtSend.SetFocus
                   
                    Beep
                    'SHOW FIRST TAB IF SOMEONE SENDS MESSAGE.  ANOUYING BUT NEEDED.
                    SSTab1.Tab = 0
                End If
                If CONNECT(Index).RELAY Then
                Beep
                Image3 = Image2
                    SENDTOALLBUTONE Index, ">>" + lblTime.Caption & ":  " & STRNAME + ": " + INCOMING
                
                End If
                
                
            End If
        
        Case "MYINFO"
            'EXTRACT THE NAME
            CUTSTRING STRCUT, INCOMING
            
            'FIRST PART IS NAME.
            STRNAME = STRCUT
            
            'NEXT CUT IS THE IP ADDRESS.
            CUTSTRING STRCUT, INCOMING
            STRIP = Winsock1(Index).RemoteHostIP ' STRCUT
            
            'SHARE IS THE NEXT PART OF STRING.
            CUTSTRING STRCUT, INCOMING
            
            'DO THEY SHARE FILES?
            If STRCUT = "YES" Then
                BLNSHARE = True
            Else
                BLNSHARE = False
            End If
            
            'INDEX IS INDEX NOW.
            STRINDEX = Index
            
            'ADD SENDERS INFO.
            CONNECT(Index).NAME = STRNAME
            CONNECT(Index).IP = STRIP
            CONNECT(Index).SHARING = BLNSHARE
            
            'ADD WHO CONNECTED TO TREE VIEW.
            Set NODTEMP = tvwConnects.Nodes.Add(, , STRNAME & STRIP, STRNAME, "FILECLOSED", "FILEOPEN")
            tvwConnects.Nodes.Item(STRNAME & STRIP).Selected = True
            tvwConnects.Nodes.Item(STRNAME & STRIP).Expanded = True
    
            
            'IS THERE OTHER CONNECTIONS AT OTHER END?
            If INCOMING <> "0" Then
                'GET THE OTHER CONNECTIONS OF NEW CONNECTION.
                GETCONNECTIONS Index, INCOMING
               Timer5.Enabled = True
               Else
               Timer5.Enabled = False
               
            End If
                  
            'UPDATE LOG, IPS.
            If ChkIPs And BLNLOG Then
                lstLogging.AddItem STRNAME & "(" & STRIP & ") CONNECTED."
            End If
            'UPDATE LOG, DATE AND TIME.
            If ChkTime And BLNLOG Then
                lstLogging.AddItem Time
            End If

            'PRINT NAME OF WHO CONNECTED IN OUTPUT TEXTBOX.
            
            
            
            
            Image2 = Image2
       
            
            txtOutput.Text = txtOutput.Text & vbCrLf & lblTime.Caption & ":  " & STRNAME & " IS CONNECTED"
            txtOutput.SelStart = Len(txtOutput.Text)
            txtSend.SetFocus
            Beep
            'TURN ON DROP CONNECTION BUTTON, SINCE THERE'S AT LEAST 1 CONNECTION.
            cmdDrop.Enabled = True
            
            'REQUEST WELCOME MESSAGE.
            SENDTOONE Index, "WELCOME,NULL"

        Case "REQUESTCONTACTS"
            'REFRESH A CONNECTION TO SEE WHO THEY'RE CONNECTED TO.
            SENDCONNECTIONS Index
            
        Case "LISTOFCONTACTS"
            'RECEIVING CONTACT LIST FROM A CONNECTION.
            CLEARNODES Index
            CUTSTRING STRCUT, INCOMING 'TAKE OUT FIRST STRING TO SEE IF THERES INFO COMING.
            INCOMING = STRCUT & "," & INCOMING 'THEN PUT IT BACK IN TO BE COMPATABLE WITH SUB CALL.
            If STRCUT > 0 Then
                GETCONNECTIONS Index, INCOMING
            End If
            
        Case "WELCOME"
            If BLNSECURE Then
                SENDTOONE Index, "PRINTWELCOME,SECURE SERVER, ENTER PASSWORD:"
            Else
                'SEND WELCOME MESSAGE TO NEW CONNECTION.
                SENDTOONE Index, "PRINTWELCOME," & STRWELCOME
            End If
            
        Case "PRINTWELCOME"
        Image2 = Image2
       
            txtOutput.Text = txtOutput.Text + vbCrLf + INCOMING
            txtOutput.SelStart = Len(txtOutput.Text)
            txtSend.SetFocus
            SENDCONNECTIONSTOALL Index
Beep

        Case "REQUESTDIR"
            'SEND YOUR FILE DIRECTORY TO WHO ASKED FOR IT.
            SENDDIR Index
            
        Case "SHOWFILES"
            'FILL BOX WITH FILES.
            FILLDIR INCOMING
            
        Case "REQUESTFILE"
            'SOMEONE REQUESTED A FILE.
            SETUPSENDFILE Index, INCOMING
            
        Case "MAKEFILE"
            CUTSTRING STRCUT, INCOMING
            'OPEN A FILE FOR WRITING.
            MAKEFILE Index, Val(STRCUT), INCOMING
            
        Case "SETUPFILE"
            'STORE THE OTHER COMPUTERS CHANNEL IN YOUR CHANNEL ARRAY.
            CUTSTRING STRCUT, INCOMING
            INTCHANNELS(STRCUT) = INCOMING
            SENDFILE Index, Val(STRCUT)
            
        Case "UPLOADINGFILE"
            'SOMEONE WANTS TO UPLOAD A FILE.
            If ChkUpload Then
                SENDTOONE Index, "REQUESTFILE," & INCOMING
                GETSENDERSINFO Index
                
            'LOG THAT IT'S A UPLOAD TO YOU, NOT ONE OF YOUR DOWNLOADS.
            If ChkTransfers Then
                lstLogging.AddItem INCOMING & " IS BEING UPLOADED FROM " & STRNAME
            End If
            
            'IF UPLOADING NOT PERMITTED. TELL THEM.
            Else
                SENDTOONE Index, "PRINT,UPLOADING NOT PERMITED."
            End If
            
        Case "SENDFILE"
            'SEND FILE BLOCK.
            'CUTSTRING STRCUT, INCOMING
            SENDFILE Index, Val(INCOMING)
            
        Case "MOREFILE"
            CUTSTRING STRCUT, INCOMING
            MOREFILE Index, Val(STRCUT), INCOMING
            
        Case "FILEDONE"
            'CUTSTRING STRCUT, INCOMING
            'TURN OFF BACKUP TIMER FOR DOWNLOADS THAT STOP PREMATURELY.
            Timer3.Enabled = False
            'END OF FILE REACHED, CLOSE CHANNEL, SET ARRAY SPOT TO 0(OPEN).
            Close #INCOMING
            INTCHANNELS(INCOMING) = 0
            
            GETSENDERSINFO Index
            Image2 = Image2
       
            txtOutput.Text = txtOutput.Text + vbCrLf + "FILE SUCCESSFULLY DOWNLOADED FROM " & STRNAME & "."
            'IF LOGGING FILE DOWNLOADS, LOG IT.
            If ChkTransfers And BLNLOG Then
                lstLogging.AddItem "FILE SUCCESSFULLY DOWNLOADED FROM " & STRNAME & "."
            End If
            File1.Refresh
            File2.Refresh
            File3.Refresh
            
            'WAS FILE A SOUND TO PLAY?
            If BLNWAV Then
                MMControl1.Command = "OPEN"
                cmdSendSound.Enabled = True
                BLNWAV = False
                MMControl1.Command = "PLAY"
            End If
            
        Case "SEARCHFOR"
            CUTSTRING STRCUT, INCOMING
            'SEARCH FOR FILE LOCALLY.
            FILESEARCH Index, STRCUT, INCOMING
            
        Case "FILEFOUND"
            'FRMCONNECT.LSTSEARCH.ADDITEM "WORKING"
            FILEFOUND INCOMING
            
        Case "PLAYWINDOWSSOUND"
            'PLAY A WINDOWS WAV FILE FROM WINDOWS FOLDER.
            PLAYWINDOWSSOUND INCOMING
            
    End Select
        
BOOBOO:

    
End Sub







Is This A Good Question/Topic? 0
  • +

Replies To: loading a profile pixture using winsock control vb6.0

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9092
  • View blog
  • Posts: 34,145
  • Joined: 12-June 08

Re: loading a profile pixture using winsock control vb6.0

Posted 27 August 2012 - 12:54 PM

Quote

i just cant get it to work.

How? In what way? If there's an error then paste the error text here along with what line of code it is happening. If the program is not behaving as expected then tell us how it is behaving now and how it should be behaving. We are not there looking over your shoulder so any amount of information you can tell us - beyond the "it's not working" - only allows to provide you with a more concise and accurate answer. Help us to help you!
Was This Post Helpful? 0
  • +
  • -

#3 flameneo  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 19-August 12

Re: loading a profile pixture using winsock control vb6.0

Posted 30 August 2012 - 10:27 AM

@ modi123_1, When i posted this thread, i was in an area where i had very poor network reception
i posted a picture, but am surprised it did not upload. don't be offended. this is the picture

Attached Image
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9092
  • View blog
  • Posts: 34,145
  • Joined: 12-June 08

Re: loading a profile pixture using winsock control vb6.0

Posted 30 August 2012 - 10:38 AM

My questions still remain..
Was This Post Helpful? 0
  • +
  • -

#5 flameneo  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 19-August 12

Re: loading a profile pixture using winsock control vb6.0

Posted 30 August 2012 - 10:42 AM

to the left, is where the picture u upload is supposed to be, to the right is where the picture of the person u're chatting with i supposed to be. the problem am having, is i am not sure how to go about the upload.
the picture uploads on my system since the address is in my base system. but how do i make the person am chatting with see the picture i uploaded? the idea i'm having is to send the picture to the host system, then load it from that system into the picture box to the right. I have no idea how to go about this, any idea on how to go about it would be appreciated.

Private Sub CMDPIX_CLICK()
Dim PROPIX As PictureBox
On Error Resume Next
PRO.ShowOpen
txtPRO.Text = PRO.FileName
Image2 = LoadPicture(txtPRO.Text)
PROPIX.Picture = Image2.Picture

Image3.Picture = PROPIX.Picture



End Sub

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1