zoukankan      html  css  js  c++  java
  • IP and userId dislay in AX 2009 title

    If you use a descriptive text on your profiles you use to startup axapta with, you have here another way of a very clear presentation of which installation, db, etc settings you are running under.
     

    Open your AOT and locate the Info class. Expand the method workspaceWindowCreated and add the following code. Next time you start axapta, your profile name will be part of the axapta window title.

    代码
    void workspaceWindowCreated(int _hWnd)
    {
    // Put workspace window specific initialization here.
    // -- Description: Show profile-name in the title bar
    session s=new Session();
    ;
    WinAPI::setWindowText(_hWnd, strFmt(
    "%1 - %2 - %3",
    //xInfo::configuration(),
    SysUserLog::IPAdress(S.sessionId()),
    s.userId(),
    WinAPI::getWindowText(_hWnd)
    )
    );

    }

    IP Address method as below:

    代码
    static str 20 IPAdress(int _SessionId)
    {
    //Jimmy 2010-04-22 remark :In order to know more quickly complete user location information, we specially added the function!
    xSession sess;
    str GetIP(str Hostname)
    {
    DLL DLL
    = new DLL("ws2_32.dll");
    DLL DLL2
    = new DLL("kernel32");
    DLLFunction CopyMemory
    = new DLLFunction(Dll2, "RtlMoveMemory");
    DLLFunction HostInfo
    = new DLLFunction(DLL, "gethostbyname");
    binary Dest
    = new binary(100);
    int Host;
    str IP;

    HostInfo.arg(ExtTypes::String);
    HostInfo.returns(ExtTypes::DWord);
    Host
    = HostInfo.call(Hostname);

    CopyMemory.arg(ExtTypes::Pointer,
    ExtTypes::DWord,
    ExtTypes::DWord);
    if(Host)
    {
    CopyMemory.call(Dest, Host,
    16);
    if(Dest.dWord(12))
    {
    CopyMemory.call(Dest, Dest.dWord(
    12), 4);

    if(Dest.dWord(0))
    {
    CopyMemory.call(Dest, Dest.dWord(
    0), 4);
    IP
    = int2str(Dest.byte(0)) + "." +
    int2str(Dest.
    byte(1)) + "." +
    int2str(Dest.
    byte(2)) + "." +
    int2str(Dest.
    byte(3));
    }
    }
    }
    return IP;
    }

    ;
    sess
    = new xSession(_SessionId);
    if(sess.clientComputerName())
    return GetIP(sess.clientComputerName());
    else
    return '';
    }
  • 相关阅读:
    /etc/sysctl.conf 控制内核相关配置文件
    python 并发编程 非阻塞IO模型
    python 并发编程 多路复用IO模型
    python 并发编程 异步IO模型
    python 并发编程 阻塞IO模型
    python 并发编程 基于gevent模块 协程池 实现并发的套接字通信
    python 并发编程 基于gevent模块实现并发的套接字通信
    python 并发编程 io模型 目录
    python 并发编程 socket 服务端 客户端 阻塞io行为
    python 并发编程 IO模型介绍
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1758553.html
Copyright © 2011-2022 走看看