?
Solved

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

Posted on 2002-06-07
11
Medium Priority
?
187 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 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

752 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