Solved

Sending a message from machine to other using API  .....

Posted on 2003-11-18
7
425 Views
Last Modified: 2008-03-03
hello to all

i am using this code to send a message from my system (sys 1) to the other system (sys 2).
its working fine..... for this i need to use APIs. but i want to send a message using the shell command. can any body give the exact syntax for it ?.
next one ... is there any way to know in/from the sencond system (sys 2)  ( ... to which i am sending the message ) that it has got the message when ever i send a message to sys 2 ?.
so that i can show a popup (just like msn messenger do) or play some sound when ever sys 2 gets a message from sys 1.

here is the code ...

Private Declare Function NetMessageBufferSend Lib  "NETAPI32.DLL" (yServer As Any, yToName As Byte,  yFromName As Any, yMsg As Byte, ByVal lSize As Long) As Long

Private Const NERR_Success As Long = 0&

Public Function BroadcastMessage(sToUser As String,  sFromUser As String, sMessage As String) As Boolean
 
   Dim yToName() As Byte
   Dim yFromName() As Byte
   Dim yMsg() As Byte
   Dim l As Long

   yToName = sToUser & vbNullChar
   yFromName = sFromUser & vbNullChar
   yMsg = sMessage & vbNullChar

   If NetMessageBufferSend(ByVal 0&, yToName(0), ByVal 0&, _
        yMsg(0), UBound(yMsg)) = NERR_Success Then
       BroadcastMessage = True
   End If
End Function

Private Sub Command1_Click()
   Dim x As Boolean
   x = BroadcastMessage(TxtTo.Text, TxtFrom.Text, TxtMsg.Text)
   If x Then
      MsgBox "Message Sent"
   Else
      MsgBox "Message Not Sent"
   End If
End Sub

any body please help me

Mohan G
0
Comment
Question by:gkmohan2003
  • 4
  • 2
7 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 125 total points
ID: 9773743
you could use net send command line:
sintax:
net send {Name| * | /domain[:Name] | /users} message

then
shell environ("ComSPEC") & " /c net send "jondoe" "hello there",vbhide

0
 

Author Comment

by:gkmohan2003
ID: 9844987
thank you richie
yes i am just looking of the same shell command. sorry i need to check this one (i am busy now ).
bye
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9951724
May I ask you why a "B" grade?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 

Author Comment

by:gkmohan2003
ID: 9956527
ok then ... let me give you higher grade
how can i give you that ?

thank you once again

Mohan g
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9956652
i think you can't but you could ask to http://www.experts-exchange.com/Community_Support/
Anyway, my Q stands......
Cheers
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 10002521
Many thanks to both.
:)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

808 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