LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 22 May 2006 13:50:34 -0600
Reply-To:   Alan Churchill <SASL001@SAVIAN.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Alan Churchill <SASL001@SAVIAN.NET>
Subject:   Re: Capture Screenshot of AF Frame
Comments:   To: Paul Walker <walker.627@OSU.EDU>
In-Reply-To:   <200605221853.k4MFu8OL024931@mailgw.cc.uga.edu>
Content-Type:   text/plain; charset="us-ascii"

Paul,

I do this in one of my utility programs (SaviColor). if you want to see what it does, download SaviColor from my utilities page.

Unfortunately, you will need to translate this from C#:

private int FH; private int FW; [System.Runtime.InteropServices.DllImport("gdi32", EntryPoint = "CreateDCA")] private static extern int CreateDC(string lpDriverName, string lpDeviceName, string lpOutput, string lpInitData); [System.Runtime.InteropServices.DllImport("GDI32")] private static extern int CreateCompatibleDC(int hDC); [System.Runtime.InteropServices.DllImport("GDI32")] private static extern int CreateCompatibleBitmap(int hDC, int nWidth, int nHeight); [System.Runtime.InteropServices.DllImport("gdi32", EntryPoint = "GetDeviceCaps")] private static extern int GetDeviceCaps(int hdc, int nIndex); [System.Runtime.InteropServices.DllImport("GDI32")] private static extern int SelectObject(int hDC, int hObject); [System.Runtime.InteropServices.DllImport("GDI32")] private static extern int BitBlt(int srchDC, int srcX, int srcY, int srcW, int srcH, int desthDC, int destX, int destY, int op); [System.Runtime.InteropServices.DllImport("GDI32")] private static extern int DeleteDC(int hDC); [System.Runtime.InteropServices.DllImport("GDI32")] private static extern int DeleteObject(int hObj);

protected void CaptureScreen() { int hSDC; int hMDC; int hBMP; int hBMPOld; int r; hSDC = CreateDC("DISPLAY", "", "", ""); hMDC = CreateCompatibleDC(hSDC); FW = GetDeviceCaps(hSDC, 8); FH = GetDeviceCaps(hSDC, 10); hBMP = CreateCompatibleBitmap(hSDC, FW, FH); hBMPOld = SelectObject(hMDC, hBMP); r = BitBlt(hMDC, 0, 0, FW, FH, hSDC, 0, 0, 13369376); hBMP = SelectObject(hMDC, hBMPOld); r = DeleteDC(hSDC); r = DeleteDC(hMDC); background = Image.FromHbitmap(new IntPtr(hBMP)); DeleteObject(hBMP); }

Alan

Alan Churchill Savian "Bridging SAS and Microsoft Technologies" www.savian.net

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Paul Walker Sent: Monday, May 22, 2006 12:54 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Capture Screenshot of AF Frame

Does anyone know how to capture a screenshot of an AF frame into some type of graphics file (such as .gif) using code? I want to automatically keep a graphical record of how the user navigated through the application. I could manually capture the screen shots using windows "ctrl + Print Screen", but is there a way to do this using SCL code? Or maybe using call system?


Back to: Top of message | Previous page | Main SAS-L page