Solved

How to send message and print-out to another computer ?

Posted on 2002-06-07
11
184 Views
Last Modified: 2013-11-13
I need someone to share with me the source or programming knowledge to develope a small application which will enable an user to send a message to a group of computer with a pop-up windows and print out the message to a printer accross the network.
0
Comment
Question by:netcool
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 200 total points
ID: 7061496
http://www.freevbcode.com/ShowCode.ASP?ID=137

Is a sample that shows how to use winsock to create a chat application that allows you to send messages to other computers.
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7061538
how abt "Net Send" in your application. And for the printing, do you want your individual users to take a print out or a general print command after the message has been sent to all the users

-priya
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7063862
As long as i know, Net send shows a message box, how do you print it?
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 2

Expert Comment

by:priya_pbk
ID: 7063988
yes you are right Richie_Simonetti, Net send only sends messages to different pc. What i was thinking is maybe the application which sends the Net send can also write to a file or a vb form and take the print out of that file or the form, something like that.

How abt if one creates a client-server application. That is the client will initiate a request to a port on the  server program which listens to some requests on different pc. If it receives it will show a form to the client pc, then maybe that person can have a customised form, which will ask him if he wants to print the form or not.

This is just a logic i was thinking, maybe there is a better way to do it.

-priya


0
 
LVL 5

Author Comment

by:netcool
ID: 7066014
Priya,what you said is what i need. Sort of client server application but i need it as simple as possible. This is a program is like emergency system which will alert the user of the building of any alarm or activity going on.
I also need user to acknowledge the message.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7067144
Simple client-server app:
http://www.vb-world.com/demos/winsock/
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7067182
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7069787
This is just a test appln code: I think you can start of with this and see how you can incorporate in your project applications:

->Project1(This is your server appln project)
Put a winsock control on yr form
-----------------------------------------------------
Private Sub Form_Load()
serverConnect
End Sub

Private Sub serverConnect()
Winsock1.LocalPort = "1114" 'any port between 0-8000 (i think. check this out)
'waiting for client's request
Winsock1.Listen

'ErrorHandler:
'MsgBox ("Port is already in use. Please close any other program using the same port....")
'End
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then Winsock1.Close
   ' Accept the request with the requestID  parameter.
 Winsock1.Accept requestID
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData


If InStr(strData, "online") >= 1 Then
        Shell "\\...yourexePath.exe", vbNormalFocus
        MsgBox "hello"
End If
'if client request is not specified string then give message
    If Error = False Then
        MsgBox ("Unknown Parameter : '" & strData & "'")
    End If
End Sub


------------------Project1 (serverprogram ends)------------


'**

Project2(client program)(Put a winsock control on this form also)
-----------------------------------------------------------
Private Sub Command1_Click()
Winsock1.Connect "200.200.15.17", 1114
'where 200.200.15.17 'is yr IP address and 1114 is the port where the server is listening and yr msg is being send
End Sub

Private Sub Winsock1_Connect()
Winsock1.SendData ("online")
End Sub

Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox Description
End Sub

Private Sub Winsock1_SendComplete()
Winsock1.Close
End
End Sub

--------------------Project2 ends--------------

How to go abt it...

In the server program:
Put a breakpoint at "serverConnect" , Winsock1_ConnectionRequest and Winsock1_DataArrival

In the client program (project2) put a breakpoint at Winsock1.SendData ("online")

Run the server program(F5) first and then start the client program. Try doing thru F8. It will give you an idea how the whole thing works.

This is just a test appn i wrote. In the shell event you can call your form by checking the paramters, whatever you want.

Hope this helps you.

-priya

0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7069883
:O, so similar!
0
 
LVL 5

Author Comment

by:netcool
ID: 7071720
All of your ANSWERs are very good and it work for me.Thanks.BUt, i will give the point to the first person who answer the question correct.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7123289
One thing is helping for free and other is working for free.
Cheers
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

820 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