Solved

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

Posted on 2003-11-18
7
428 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 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

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!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month9 days, 12 hours left to enroll

623 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