Results 1 to 12 of 12

Thread: Remote Message Box Popup

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Location
    New Brunswick, Canada
    Posts
    30

    Exclamation Remote Message Box Popup

    im having little piss of problems with my code can someone tell me whats wrong with it ?

    Visual Basic 6.0

    In Client
    VB Code:
    1. Private Sub cmdSend_Click()
    2. Dim Data10
    3. Data10 = txtNick.Text & ": " & txtMessage.Text
    4. Winsock.SendData Data10
    5. End Sub


    In Server
    VB Code:
    1. Case "Data10"
    2. Winsock(Index).GetData incommingData, vbString
    3. If incommingData = "Data10" Then
    4. Data10 = MsgBox Date10, ("Message From Master")
    5.     End If
    6.     Exit Sub

    If anyone can fix it up and tlel me what was wrong it would help me a lot

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Remote Message Box Popup

    Heres the data arrival sub on server:
    VB Code:
    1. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    2. Dim strData As String
    3.  
    4. Winsock1(Index).GetData strData 'get the data
    5.  
    6. If Left(strData, 4) = "MSG " Then 'if the first part of the data says MSG
    7.     MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master" 'Show msgbox for example    Chris: HEY
    8. End If
    9.  
    10. End Sub

    And in the client...
    VB Code:
    1. Private Sub cmdSend_Click()
    2. Dim Data as String
    3. Data = "MSG " & txtNick.Text & ": " & txtMessage.Text
    4. Winsock.SendData Data
    5. End Sub
    Chris

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Location
    New Brunswick, Canada
    Posts
    30

    Re: Remote Message Box Popup

    but on server its a Select Case because it has multiple commands

    for example on sever I have

    VB Code:
    1. Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
    2. Dim incommingData As String
    3. Winsock.GetData incommingData
    4.  
    5.  
    6. Select Case incommingData
    7.     Case "closeserver"
    8. End
    9.     Exit Sub
    10.     Case "strData"
    11. Dim strData As String
    12. Winsock.GetData strData
    13. If Left(strData, 4) = "MSG" Then
    14. MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master"End If
    15.     Exit Sub
    16.     Case "closeserver2"
    17. End
    18.     Exit Sub
    19.     End Select
    20. End Sub


    and on Client I have

    VB Code:
    1. Private Sub cmdSend_Click()
    2. Dim strData As String
    3. strData = "MSG" & txtNick.Text & ": " & txtMessage.Text
    4. Winsock.SendData strData
    5. End Sub

    should that work im useing Select Case's so... can you help?

  4. #4
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Remote Message Box Popup

    have this as your select statement...

    VB Code:
    1. Select Case incommingData
    2.     Case "closeserver"
    3.         winsock.Close
    4.         Unload Me
    5.     Case Left(strData, 4) = "MSG "
    6.         MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master"
    7. End Select
    Chris

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Location
    New Brunswick, Canada
    Posts
    30

    Re: Remote Message Box Popup

    Vaiable not defined?

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Remote Message Box Popup

    Quote Originally Posted by GoldenZero
    Vaiable not defined?
    What variable?

  7. #7
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Remote Message Box Popup

    you need to replace strData with incommingData
    Chris

  8. #8
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Remote Message Box Popup

    actually that select statement wont work, select only works if you know exactly which part of the data you want to check, if you want to check the first part and all of it, you need an if like in my first post
    Chris

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Location
    New Brunswick, Canada
    Posts
    30

    Re: Remote Message Box Popup

    but what you have in your first post doesn't work

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Location
    New Brunswick, Canada
    Posts
    30

    Re: Remote Message Box Popup

    heres what I got


    Client
    VB Code:
    1. Private Sub cmdSend_Click()
    2. Dim Data10 As String
    3. Data10 = "MSG" & txtNick.Text & ": " & txtMessage.Text
    4. Winsock.SendData Data10
    5. End Sub


    Server
    VB Code:
    1. Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
    2. Dim incommingData As String
    3. Winsock.GetData incommingData
    4.  
    5. If Left(incommingData, 4) = "MSG" Then
    6.     MsgBox Split(incommingData, ":")(0) & ": " & Split(incommingData, ":")(1), vbInformation, "Message From Master"
    7. End If
    8.  
    9. Select Case incommingData
    10.     Case "closeserver"
    11. End
    12.     End Select

    It looks ok to me but something wrong.. any ideas?

  11. #11
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Remote Message Box Popup

    Yes there is a problem with that....if someone posts code...dont change it or it will die, so why have you removed the space after "MSG " ??? read the statement left(..., 4) so theres for characters....."MSG " is 4, you changed it to "MSG" which is three, thats whats wrong

    you also changed it in the client part too... "MSG " is what i said, not "MSG" if you want "MSG" then change the number to 3
    Chris

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Location
    New Brunswick, Canada
    Posts
    30

    Re: Remote Message Box Popup

    ohhhhhh I see thanks

    ohya I thought you put space by mistake but i see now
    Last edited by GoldenZero; Feb 28th, 2006 at 06:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width