Solved

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

Posted on 2002-06-07
11
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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 …
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

738 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