Solved

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

Posted on 2003-11-18
7
427 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

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…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

751 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