Solved

What is the best way to invoke Interactive Dialogs (Popup, Messagebox, IE windows, etc) on Remote Machines on a Network in VB.NET?

Posted on 2004-09-09
8
194 Views
Last Modified: 2010-04-23
Question is pretty self explanatory... I have always wondered what a good way to display some form of popup (preferrably as nice an interface as possible (not just a plain message box if possible) on remote machines would be.... Say for example I have a console on my machine locally, and it goes out to a number of machines, displays a popup stating "X will happen in a few minutes, please be patient...etc etc", and my process would start in "x" amount of time and go through the process and notify them again upon completion....

Anyone have any good suggestions?

Thanks

0
Comment
Question by:phesser
  • 5
  • 3
8 Comments
 
LVL 10

Expert Comment

by:prakash_prk
ID: 12023712

Run your client program in the client machine.
send request from your server program to client program 'to display message box ' after completing send a request from client to server .

0
 

Author Comment

by:phesser
ID: 12026264
Sorry prakash_prk but I need more explanation than that.... I dont know how to do client > server model programming yet... I just have one console application and want to just send a dialog popup to a remote machine and looking for the simplest way, plus some code examples.

Thanks
0
 

Author Comment

by:phesser
ID: 12060676
Still have not received a response on this... anyone have input??
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 10

Expert Comment

by:prakash_prk
ID: 12061396
Server Program
-----------------------------
Imports System.Net.Sockets
Imports System.Text
Class TCPSrv
    Shared Sub Main()
        ' Must listen on correct port- must be same as port client wants to connect on.
        Const portNumber As Integer = 8000
        Dim tcpListener As New TcpListener(portNumber)
        tcpListener.Start()
        Console.WriteLine("Waiting for connection...")
        Try
            'Accept the pending client connection and return
            'a TcpClient initialized for communication.
            Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient()
            Console.WriteLine("Connection accepted.")
            ' Get the stream
            Dim networkStream As NetworkStream = tcpClient.GetStream()
            ' Read the stream into a byte array
            Dim bytes(tcpClient.ReceiveBufferSize) As Byte
            networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
            ' Return the data received from the client to the console.
            Dim clientdata As String = Encoding.ASCII.GetString(bytes)
            Dim totalData() As String
            Dim ds As Microsoft.VisualBasic.MsgBoxResult
            totalData = Microsoft.VisualBasic.Split(clientdata, ":")
            If totalData(0) = "ShowMessageBox" Then
                ds = Microsoft.VisualBasic.MsgBox(totalData(1))
            End If

            Dim responseString As String = "Result for MessageBox" & vbCrLf & ds.ToString
            Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(responseString)
            networkStream.Write(sendBytes, 0, sendBytes.Length)

            'Any communication with the remote client using the TcpClient can go here.
            'Close TcpListener and TcpClient.
            tcpClient.Close()
            tcpListener.Stop()
            Console.WriteLine("exit")
            Console.ReadLine()
        Catch e As Exception
            Console.WriteLine(e.ToString())
            Console.ReadLine()
        End Try
    End Sub
End Class
----------------------------------
CLient Program
-----------------------------------

Imports System.Net.Sockets
Imports System.Text
Class TCPCli
        Shared Sub Main()

            Dim tcpClient As New System.Net.Sockets.TcpClient
            tcpClient.Connect("127.0.0.1", 8000) ' This address must be the server ip address
            Dim networkStream As NetworkStream = tcpClient.GetStream()
            If networkStream.CanWrite And networkStream.CanRead Then

            ' Do a simple write.
            Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("ShowMessageBox:Message goes here")
                networkStream.Write(sendBytes, 0, sendBytes.Length)
                ' Read the NetworkStream into a byte buffer.
                Dim bytes(tcpClient.ReceiveBufferSize) As Byte
                networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
                ' Output the data received from the host to the console.
                Dim returndata As String = Encoding.ASCII.GetString(bytes)
            Console.WriteLine(("Host returned: " + returndata))

            Else
                If Not networkStream.CanRead Then
                    Console.WriteLine("cannot not write data to this stream")
                    tcpClient.Close()
                Else
                    If Not networkStream.CanWrite Then
                        Console.WriteLine("cannot read data from this stream")
                        tcpClient.Close()
                    End If
                End If
            End If
            ' pause so user can view the console output
            Console.ReadLine()
        End Sub
    End Class

----------------------

Both of them are console applications.

regards
prakash
0
 

Author Comment

by:phesser
ID: 12063962
Prakash,

Maybe I didnt explain myself clearly.  I am looking for some simple form of popup that I can 'send' from a administrator machine, to any number of remote machines 'without' there being any form of console on the target remote machines.  Basically like a remote msgbox....

Will I have to go the client / server model to accomplish this?
0
 
LVL 10

Accepted Solution

by:
prakash_prk earned 300 total points
ID: 12065023
There is a way to doing that

a command available in windows nt series machines

net send <machine name> "Message"
net send * "Message"                                 -> it send message to all the computers in the network
--------
it simple send a winpopup message to the computer specified

Try this command
 Microsoft.VisualBasic.Shell("net send * ""hai"" ", AppWinStyle.Hide, False)

regards
prakash
0
 

Author Comment

by:phesser
ID: 12067150
Thats cool I can try that, should work, but was just curious if there were any inherent classes that did the same thing in a more advanced graphical manner (add graphics, etc) ;)

I will leave this open till tommorow to see if anyone else has other input, then if a  better answer doesnt come in I will award you the points.

Thanks for all the help prakash
0
 

Author Comment

by:phesser
ID: 12089608
Didnt really get the answer I was looking for but appreciate the attempt.  Here are your points.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question