Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-11-18
7
Medium Priority
?
429 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
[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
  • 4
  • 2
7 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 500 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
Technology Partners: 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!

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

719 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