|
-
Sep 9th, 2002, 06:51 AM
#1
Thread Starter
New Member
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
-
Sep 9th, 2002, 06:59 AM
#2
Hyperactive Member
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
-
Sep 9th, 2002, 07:01 AM
#3
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
-
Sep 9th, 2002, 07:15 AM
#4
^:^...ANGEL...^:^
Hmm...
I am not an expert but how about this...
use DOS's shell execute and NET SEND command...
just a suggestion BTW...
Cheers...
-
Sep 9th, 2002, 07:22 AM
#5
Hyperactive Member
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:
if left(tmpStr, len("DoMSGBOX_") then
tmpStr = right(tmpStr,len(tmpStr) - len("DoMSGBOX_"))
msgbox tmpStr, vbOkOnly + vbExclamation, "Remote Message Box"
else
'do something other maybe another remote command...
end if
"Experience is something you don't get until just after you need it."
-
Sep 9th, 2002, 07:30 AM
#6
Banned
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.
-
Sep 9th, 2002, 07:42 AM
#7
Lively Member
VB Code:
Private Sub WinsockTCP_ConnectionRequest _
(requestID As Long)
If Winsock1.State <> sckClosed Then Winsock1.Close
rec = msgbox ("want to connect : " & WinsockTCP.remotehostIP, vbyesno)
if rec=vbyes then WinsockTCP.Accept requestID
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|