Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools


Click here to copy the following block
'Description: Send to msg to a machine on a Windows NT domain
'       similar to that of the notification msg from printer spooler
'Note: Use with care to avoid a broadcasting to all workstations on the domain
' if you do not want to

Declare Function NetMessageBufferSend Lib "netapi32.dll" ( _
    ByVal sNullParam As String, ByVal pszServer As String, ByVal pszRecipient As String, _
    ByVal pbBuffer As String, ByVal cbBuffer As Long) As Long

Function SendMsg(sToDomn As String, sFromWho As String, _
  sToWho As String, sTheMsg As String) As Boolean

  Dim lReturn   As Long
  Dim sToMachine As String * 256
  Dim sToDomain  As String
  Dim sFrom    As String * 256
  Dim sMessage  As String * 256
  Dim lLength   As Long

  SendMsg = False
  lLength = 256
  '//Only unicode string because LanManager Apis uses unicode string
  sToMachine = StrConv(sToWho & vbNullChar, vbUnicode)
  sToDomain = StrConv(sToDomn, vbUnicode) + vbNullChar
  sFrom = StrConv(sFromWho & vbNullChar, vbUnicode)
  sMessage = StrConv(Left$(sTheMsg, 256) & vbNullChar, vbUnicode)

  lReturn = NetMessageBufferSend(sToDomain, sToMachine, sFrom, sMessage, lLength)

  If lReturn = 0 Then
    SendMsg = True
  End If
End Function


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.