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
190 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
Comment Utility

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
Comment Utility
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
Comment Utility
Still have not received a response on this... anyone have input??
0
 
LVL 10

Expert Comment

by:prakash_prk
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:phesser
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Didnt really get the answer I was looking for but appreciate the attempt.  Here are your points.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now