• Using x++ coede take screenshots from Dynamics AX 2009 FormControls or Jobs


    Wrote by Jimmy on Jan 21th 2011

     

    1)Jobs

    static void Jimmy_ImagesSavedFullScreen(Args _args)
    {
        System.Drawing.Bitmap           bitmap;
        System.Drawing.Graphics         graphics;
        System.Windows.Forms.Screen     primaryScreen;
        System.Drawing.Rectangle        bounds;
        int                             x, y, k, l;
        str                             SaveToFileName;
        System.Int32                    width;
        System.Int32                    height;
        filename                        filename;
        #WINAPI
        #define.FileName('DynamicsAx_Screenshot.png')
    ;
        try
        {
            // 5 for the My Documents folder
            SaveToFileName  = strfmt(@"%1\%2",WinApi::getFolderPath(5),#FileName);
            if(winapi::fileExists(SaveToFileName,false))
                winapi::deleteFile(SaveToFileName);
            primaryScreen   = System.Windows.Forms.Screen::get_PrimaryScreen();
            bounds          = primaryScreen.get_Bounds();
     
            [x, y, k, l]    = WinApi::getWindowRect(infolog.hWnd());
     
            //width           = 1280;//_control.widthValue();
            //height          = 800;//_control.heightValue();
            width       = WinAPI::getSystemMetrics(#SM_CXSCREEN);
            height      = WinAPI::getSystemMetrics(#SM_CYSCREEN);
    
            // TwC: used API CLRObject
            // BP Deviation Documented
            bitmap          = new System.Drawing.Bitmap(width,height);
     
            graphics        = System.Drawing.Graphics::FromImage(bitmap);
            graphics.CopyFromScreen(x,y,0,0,bitmap.get_Size());
     
            bitmap.Save(SaveToFileName, System.Drawing.Imaging.ImageFormat::get_Png());
        }
        catch(exception::Error)
        {
            error("The file could not be saved"); // TODO make label
        }
        if(winapi::fileExists(SaveToFileName,false))
            winapi::shellExecute(SaveToFileName);
    
    }
    

     2)FormControls

    public void run(FormControl _control)
    {
        System.Drawing.Bitmap           bitmap;
        System.Drawing.Graphics         graphics;
        System.Windows.Forms.Screen     primaryScreen;
        System.Drawing.Rectangle        bounds;
     
        int                             x, y, k, l;
        str                             SaveToFileName;
        System.Int32                    width;
        System.Int32                    height;
     
        #define.FileName('DynamicsAx_Screenshot.png')
        ;
     
        try
        {
            // 5 for the My Documents folder
            SaveToFileName  = strfmt(@"%1\%2",WinApi::getFolderPath(5),#FileName);
     
            primaryScreen   = System.Windows.Forms.Screen::get_PrimaryScreen();
            bounds          = primaryScreen.get_Bounds();
     
            [x, y, k, l]    = WinApi::getWindowRect(_control.hWnd());
     
            width           = _control.widthValue();
            height          = _control.heightValue();
     
            // TwC: used API CLRObject
            // BP Deviation Documented
            bitmap          = new System.Drawing.Bitmap(width,height);
     
            graphics        = System.Drawing.Graphics::FromImage(bitmap);
            graphics.CopyFromScreen(x,y,0,0,bitmap.get_Size());
     
     
            bitmap.Save(SaveToFileName, System.Drawing.Imaging.ImageFormat::get_Png());
        }
        catch
        {
            error("The file could not be saved"); // TODO make label
        }
    }
    
  • 相关阅读:
    游标
    js问题杂记
    博客园页面设置
    Natas13 Writeup(文件上传,绕过图片签名检测)
    Natas12 Writeup(文件上传漏洞)
    Natas11 Writeup(常见编码、异或逆推、修改cookie)
    Natas10 Writeup(正则表达式、grep命令)
    Natas9 Writeup(命令注入)
    Natas8 Writeup(常见编码、php函数)
    Natas7 Writeup(任意文件读取漏洞)
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1940844.html
Copyright © 2020-2023  润新知