APL calls Windows .NET to generate Display Capture
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
4 posts
• Page 1 of 1
APL calls Windows .NET to generate Display Capture
Greetings.
Is there already a utility or tool that can be called from Dyalog APL to generate a Windows screen capture?
I see that MS Windows 10 has an API to do this ...
but requires some .NET coding and deeper understanding of Windows Threads.
I have an APL application developed that is tightly integrated with EXCEL. APL updates EXCEL with some data, and EXCEL draws some charts.
I'd like APL to then invoke a Windows Screen Capture ...
best if I could specify the display X1, X2 and Y1, Y2 coordinates for the capture.
(Or the EXCEL object name for the target chart)
The captured image would then be SAVED to a Windows file in a target folder path.
Thoughts?
https://docs.microsoft.com/en-us/window ... en-capture
Thanks!
//W
Is there already a utility or tool that can be called from Dyalog APL to generate a Windows screen capture?
I see that MS Windows 10 has an API to do this ...
but requires some .NET coding and deeper understanding of Windows Threads.
I have an APL application developed that is tightly integrated with EXCEL. APL updates EXCEL with some data, and EXCEL draws some charts.
I'd like APL to then invoke a Windows Screen Capture ...
best if I could specify the display X1, X2 and Y1, Y2 coordinates for the capture.
(Or the EXCEL object name for the target chart)
The captured image would then be SAVED to a Windows file in a target folder path.
Thoughts?
https://docs.microsoft.com/en-us/window ... en-capture
Thanks!
//W
-
woody - Posts: 144
- Joined: Tue Dec 28, 2010 12:54 am
- Location: Atlanta, Georgia USA
Re: APL calls Windows .NET to generate Display Capture
If by "tightly integrated" you mean using OLE to communicate, then you can export the charts as images directly from Excel. This will be both less fiddly than taking screenshots, and also probably allow you better control of the image resolution.
Had a look just now and after some teething pains managed to export a chart directly from Excel via OLE using:
All the Chart object properties and methods are documented here:
https://docs.microsoft.com/en-us/office ... art(object)
although it is a bit of a task deciphering the VB/VBA/C# examples for APL (e.g. https://docs.microsoft.com/en-us/office ... art.export)
Had a look just now and after some teething pains managed to export a chart directly from Excel via OLE using:
- Code: Select all
(XL.Workbooks[1].Sheets[1].ChartObjects ⍬)[1].Activate
XL.ActiveChart.Export⊂('c:\d\tmp\MyChart.jpg')
All the Chart object properties and methods are documented here:
https://docs.microsoft.com/en-us/office ... art(object)
although it is a bit of a task deciphering the VB/VBA/C# examples for APL (e.g. https://docs.microsoft.com/en-us/office ... art.export)
- RichardP|Dyalog
- Posts: 30
- Joined: Fri Oct 12, 2018 3:05 pm
Re: APL calls Windows .NET to generate Display Capture
I am not sure if function I wrote many years ago would help:
I am unable to test this code at the moment as on my PC, the "PrintScreen" button now activates "LightShot".
- Code: Select all
PrintScreen;keybd_event;ke;cl;bm
⍝ Copies the ACTIVE window to the clipboard
⍝An application can simulate a press of the PRINTSCREEN key in order
⍝to obtain a screen snapshot and save it to the clipboard.
⍝To do this, call keybd_event with the bVk parameter set to VK_SNAPSHOT,
⍝and the bScan parameter set to 0 for a snapshot of the full screen
⍝or set bScan to 1 for a snapshot of the active window.
⍝ VOID keybd_event(
⍝ BYTE bVk, // virtual-key code
⍝ BYTE bScan, // hardware scan code
⍝ DWORD dwFlags, // flags specifying various function options
⍝ DWORD dwExtraInfo // additional data associated with keystroke
⍝);
⍝ VK_SNAPSHOT 2C PRINT SCREEN key
'ke'⎕NA'user32.C32|keybd_event I1 I1 I4 I4'
ke 44 1 0 0
I am unable to test this code at the moment as on my PC, the "PrintScreen" button now activates "LightShot".
Ray Cannon
Please excuse any smelling pisstakes.
Please excuse any smelling pisstakes.
-
ray - Posts: 221
- Joined: Wed Feb 24, 2010 12:24 am
- Location: Blackwater, Camberley. UK
Re: APL calls Windows .NET to generate Display Capture
Thanks, Richard and Ray !
I'll give the EXCEL code a try.
I'll give the EXCEL code a try.
-
woody - Posts: 144
- Joined: Tue Dec 28, 2010 12:54 am
- Location: Atlanta, Georgia USA
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group