Results 1 to 2 of 2

Thread: how do API's work?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Location
    UK
    Posts
    99

    how do API's work?

    hey all i can call on API's in visual basic cant i?
    and how do i do it
    how would i get the following cod to work(and yes i do no stuff needs to be replaced with proper servers and stuffs)

    #define UNICODE
    #define MESGLEN 50
    WCHAR awcToName[] = TEXT("DomainName*");
    WCHAR awcFromName[] = Text("MyComputer");
    WCHAR awcMesgBuffer[MESGLEN] = Text("This ia Test Message");
    NET_API_STATUS nasStatus;

    nasStatus = NetMessageBufferSend(NULL,
    awcToName,
    awcFromName,
    awcMesgBuffer,
    MESGLEN);

    i just wanna no how i would actualy make this work!
    do i need controls can some one send a for with it working on plz
    thanx
    TrAcER

  2. #2
    jim mcnamara
    Guest
    Two things:
    1. get the apiveiwer & api-guide from www.allapi.net.
    Free. Good.

    2. Looks like something from MSDN. Here is VB code for the same api call (from guess where?:

    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 SendMessage(RcptToUser As String, _
       FromUser As String, BodyMessage As String) As Boolean
     
       Dim RcptTo() As Byte
       Dim From() As Byte
       Dim Body() As Byte
    
       RcptTo = RcptToUser & vbNullChar
       From = FromUser & vbNullChar
       Body = BodyMessage & vbNullChar
    
       If NetMessageBufferSend(ByVal 0&, RcptTo(0), ByVal 0&, _
            Body(0), UBound(Body)) = NERR_Success Then
         SendMessage = True
       End If
    
    End Function
    Private Sub Form_Load()
        'Example created by X-MaD ([email protected])
        'Visit his website at http://www.zolnetwork.com/x-mad
        Dim RetVal As Boolean
        RetVal = SendMessage("Utente", "FromUser", "BodyText")
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width