Solved

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

Posted on 2003-11-18
7
422 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now