Показать сообщение отдельно
Старый 27.03.2008, 18:01   #3  
AndyD is offline
AndyD
Участник
КОРУС Консалтинг
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
 
2,560 / 2476 (88) +++++++++
Регистрация: 20.08.2005
Не знаю,как в цитриксе, а в WTS можно сделать так
X++:
static void WTSClientAddress(Args _args)
{
    dll dll = new Dll("Wtsapi32.dll");
    DLLFunction WTSOpenServer = new DLLFunction(dll, "WTSOpenServerA");
    DLLFunction WTSCloseServer = new DLLFunction(dll, "WTSCloseServer");
    DLLFunction WTSQuerySessionInformation = new DLLFunction(dll, "WTSQuerySessionInformationA");
    DLLFunction WTSFreeMemory = new DLLFunction(dll, "WTSFreeMemory");

    int handle;
    Binary  ptr = new Binary(4);
    Binary  buf;
    Binary  size = new Binary(4);
    int i;
    #define.WTS_CURRENT_SERVER_HANDLE  (0)
    #define.WTS_CURRENT_SESSION (-1)
    #define.WTSClientAddress(14)
    #define.byteOne     (4+2+0)
    #define.byteTwo     (4+2+1)
    #define.byteThree   (4+2+2)
    #define.byteFour    (4+2+3)
    ;
    WTSOpenServer.arg(ExtTypes::DWord);
    WTSOpenServer.returns(ExtTypes::DWord);
    handle = WTSOpenServer.call(#WTS_CURRENT_SERVER_HANDLE);
    if (handle)
    {
        WTSQuerySessionInformation.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord,
            ExtTypes::Pointer, ExtTypes::Pointer);
        WTSQuerySessionInformation.returns(ExtTypes::DWord);
        if (WTSQuerySessionInformation.call(handle, #WTS_CURRENT_SESSION, #WTSClientAddress,
                ptr, size) && size.dWord(0) > 0)
        {
            buf = new Binary(size.dWord(0));
            buf.attach(ptr.dWord(0), size.dWord(0));
            if (buf.dWord(0) == 2)
            {
                info(strfmt("%1.%2.%3.%4", buf.byte(#byteOne), buf.byte(#byteTwo), buf.byte(#byteThree), buf.byte(#byteFour)));
            }
            WTSFreeMemory.arg(ExtTypes::DWord);
            WTSFreeMemory.call(ptr.dWord(0));
        }

        WTSCloseServer.arg(ExtTypes::DWord);
        WTSCloseServer.call(handle);
    }
}
может и под цитриксом будет работать?
__________________
Axapta v.3.0 sp5 kr2
За это сообщение автора поблагодарили: Logger (5), aidsua (1).