?
Solved

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

Posted on 2002-06-07
11
Medium Priority
?
192 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 600 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

850 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