rogan

rogan

  • NA
  • 7
  • 0

NetMessageBufferSend API...

Dec 22 2003 8:09 AM
Hi all, thanks for reading this message, i hope someone can help me. Althought I´m very familiar with C and Visual Basic i´m totally newbie in C#. I´m developing a little APP that sends pop up windows to registered network users with NetMessageBufferSend API, but I cannot implement it properly on C#, this is the declaration of the API in VB 6 Private Declare Function NetMessageBufferSend Lib "netapi32" (ByVal servername As String, ByVal msgname As String, ByVal fromname As String, ByVal msgbuf As String, ByRef msgbuflen As Long) As Long And this is my APP Code: [DllImport("netapi32.dll")] static extern short NetMessageBufferSend (string servername, string msgname, string fromname, string msgbuf , ref short msgbuflen); And I call the function this way... short success=0; short len=0; string msg = "Hello!"; len=(short)msg.Length; success = NetMessageBufferSend(System.Net.Dns.GetHostName(),System.Net.Dns.GetHostName(), "" ,msg,ref len); for testing purposes. success var returns 123 which is ... Private Const ERROR_INVALID_NAME As Long = 123 I cannot make it work, and i really want to make it run on c#, if someone has a clue, post here. Thanks a bunch for reading this. :)

Answers (7)