Results 1 to 7 of 7

Thread: Sending a MsgBox to a remote computer

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Location
    Perth
    Posts
    1

    Sending a MsgBox to a remote computer

    Hi, I'm starting off a network chat program

    I'm trying to send a msgbox to a remote computer asking if it wants to accept the conection to the chat program
    this is the code, there's not much there but hey, gotta start somewhere


    Private Sub Form_Load()
    Winsock1.RemotePort = 1000
    Winsock1.Bind 1000

    End Sub
    Private Sub cmdCall_Click()
    Winsock1.RemoteHost = txtAddress
    Winsock1.SendData MsgBox("You are being Called By " & txtName, vbYesNo, "ACCEPT?")
    End Sub

    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Winsock1.GetData
    End Sub

  2. #2
    Hyperactive Member AvisSoft's Avatar
    Join Date
    Sep 2002
    Location
    Chandigarh
    Posts
    459
    I think you can't send message box like that! You must do something like this:

    Make some message like "MSGBOXCALLEDBY, " & txtName

    now at your other end when you recieve this string you open the msgbox there...


    if user accepts the connection u can send the reply as "CALLACCEPTED" or something like that!

    Hope this gives some info!

    Thanks!
    Tapan Bhanot,
    CEO, Avis Software.
    Website: www.avissoftware.com

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    you can't really do that because your just sending text... since your app is compiled.. if it gets text then it does not know that it is code you are trying to execute...

    you are better off passing some kind of text that tells the client do display a message box... something like

    senddata "MESSAGE:You are being Called By..."

    and you the recieve you parse the text to see if it is a message to display

  4. #4
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up Hmm...

    I am not an expert but how about this...

    use DOS's shell execute and NET SEND command...

    just a suggestion BTW...

    Cheers...

  5. #5
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    425
    Originally posted by AvisSoft
    I think you can't send message box like that! You must do something like this:

    Make some message like "MSGBOXCALLEDBY, " & txtName

    now at your other end when you recieve this string you open the msgbox there...


    if user accepts the connection u can send the reply as "CALLACCEPTED" or something like that!

    Hope this gives some info!

    Thanks!
    I agree. You must send a string to the other PC, and when it receives this string and the string contains a custom command like "DoMSGBOX_Hello Stupid" you can make the otehr application preform a msgbox with the string.

    When you receive the string in a var like 'tmpStr' just do:

    VB Code:
    1. if left(tmpStr, len("DoMSGBOX_") then
    2.   tmpStr = right(tmpStr,len(tmpStr) - len("DoMSGBOX_"))
    3.   msgbox tmpStr, vbOkOnly + vbExclamation, "Remote Message Box"
    4. else
    5.   'do something other maybe another remote command...
    6. end if
    "Experience is something you don't get until just after you need it."

  6. #6
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180

    Re: Hmm...

    Originally posted by wrack
    I am not an expert but how about this...

    use DOS's shell execute and NET SEND command...

    just a suggestion BTW...

    Cheers...
    I thought that only works in Win NT. But since Capri72 didn't specify on what platforms he was working, this might just do the trick.

  7. #7
    Lively Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    105
    VB Code:
    1. Private Sub WinsockTCP_ConnectionRequest _
    2. (requestID As Long)
    3.    If Winsock1.State <> sckClosed Then Winsock1.Close
    4.    rec = msgbox ("want to connect : " & WinsockTCP.remotehostIP, vbyesno)
    5.    if rec=vbyes then  WinsockTCP.Accept requestID
    6. End Sub
    Shahab Ahmed

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