Показать сообщение отдельно
Старый 17.09.2008, 13:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
dax-lessons: Alert user using Net send - x++
Источник: http://DAX-Lessons.spaces.live.com/B...FCD1!184.entry
==============


Sending messages to the users in network using NET SEND in x++


Microsoft Windows offers a simple method to send messages to otherusers or computers on the network - simple WinPopup Messages or Net SendMessages ( in Windows 95, Windows 98, Windows Me, Windows NT, Windows2000, Windows XP and Windows 2003 ).

Prerequisite: Start Messenger service from Start >> Programs >> Administrative tools >> messenger.

Here is the job which will send messages to the users/computers on network.


static void netSend(Args _args)
{
    str computerName =  Winapi::getComputerName();
    //str computerName = 'giri';
    str message  = 'Hello.. I am alerting from Dynamics AX';

    COM                 netSendCom;
    InteropPermission   permission = new InteropPermission(InteropKind::ComInterop);
    int                 output;

    // Receiving end should start messenger service and alerter service from services.msc
 
    permission.assert();
    try
    {
        netSendCom = new COM("WScript.Shell");
        output = netSendCom.Run(strFmt("net send %1 %2", computerName, message),0,true);
    }
    catch (Exception::Error)
    {
        CodeAccessPermission::revertAssert();
        throw Exception::Error;
    }
   
    if (output != 0)
    {
       warning(strfmt('Net send Failed', computerName));
       warning('Check whether Alerter and messenger services are Started');
    }
   
    CodeAccessPermission::revertAssert();

}

Here is the net send message popup







Источник: http://DAX-Lessons.spaces.live.com/B...FCD1!184.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.