CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Location
    FRANCE, Toulouse
    Posts
    39

    Sending message like Net Send command

    Hi,
    How can I read message (using code) arriving to a computer from another computer using the Net Send command.
    I only know it uses mailslot, but what's its name ?


  2. #2
    Guest

    Re: Sending message like Net Send command

    USES_CONVERSION;

    CString sMessage;
    sMessage.Format("This is a test message");

    CString sMsgName = _T("EVERYONE");

    LPCWSTR pszMessage = A2CW(sMessage);

    DWORD dwLen = wcslen(pszMessage) * sizeof(WCHAR);

    NET_API_STATUS nStatus;

    nStatus = NetMessageNameAdd(NULL, A2CW(sMsgName));

    nStatus = NetMessageBufferSend(NULL, A2CW(sMsgName), NULL, (LPBYTE)pszMessage, dwLen);

    NetMessageNameDel(NULL, A2CW(sMsgName));



  3. #3
    Join Date
    May 1999
    Location
    FRANCE, Toulouse
    Posts
    39

    Re: Sending message like Net Send command

    And for receiving arriving messages ?


  4. #4
    Join Date
    May 1999
    Location
    Fort Worth Texas
    Posts
    614

    Re: Sending message like Net Send command

    I have tried this code and it works on my workstation but I am not able to send a message to another workstation.

    I am trying to make use of the NetMessageNameAdd and NetMessageBufferSend commands. I want to specific want machine the message will be seen on but I don't see in the argument list how to specify that, how does one do that. The first argument in both functions is the server name and the notes state the string must start with \\ but when I place the name of my workstation there with the \\ it doesn't work. If I place the name of my workstation without the \\ it works...I don't understand.

    Thanks


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

Featured