No simple way
You have to use external DLL or ActiveX
If it helps, i can post part of my ActiveX library for Citect SCADA (Rad studio), that utilize this:
procedure GetScreenShot(var Bmp:TBitmap);
function ScreenShotToFileJPG(sFileFullName:String):boolean;
Never tried, but how about this: http://proscada.ru/ctkbase.en/articles/q5166.html
FUNCTION capture_screen()
//Memory or Local variable defined in the project
counter=counter+1;
// Open the Trend page of the project
PageDisplay("Trend");
Sleep(1);
// Capture a screenshot of the trend page
SendKeys("Trend", "{prtsc}");
// Open Microsoft Paint application. Use Mode '6' if wnat the paint window Minimized
Exec("mspaint", 1);
Sleep(3);
// Paste the clipboard into Paint
SendKeys("untitled - Paint", "^(v)");
Sleep(1);
// Open the 'Save As' menu
SendKeys("untitled - Paint", "^(s)");
Sleep(1);
// Enter the name of the screenshot: image_<screenshot's number>
SendKeys("Save As", "image_" + IntToStr(counter));
Sleep(1);
// Change to the 'save as' field
SendKeys("Save As", "{tab}");
Sleep(1);
// Select 'JPG' as type
SendKeys("Save As", "j");
Sleep(1);
// Save the file
SendKeys("Save As", "{enter}");
Sleep(1);
// Close Paint
SendKeys("image_" + IntToStr(counter) + ".JPG - Paint", "%({f4})");
SleepMS(500);
// Go back to the last page displayed before screenshot
PageLast();
IMHO, using ms paint via that macros when we have got a live operator at the PC or programs that can grab focus is not good idea. Direct using API functions is much more reliable. But yes, this is more simple.
Sure, I see what you're saying. From User Interface prospective I agree, but at the same time the screenshot is only taken if the Operator wants to make the screenshot so it is not the worst option, the Operator just needs to know what to expect.
On the other hand, there are so many Screenshot Utilities on the market (paid and free, but most free are not free for commercial use) that you can just hit Printscreen button on the keyboard and the screenshot is made automatically (even Dropbox can do that).
Did you know that Win+PrScr buttons will make a screenshot automatically to C:\Users\#USER#\Pictures\Screenshots (works in Windows 8 and Windows 10). This option could be WAY easier then.
thank you all.
But I have a problem the SendKeys return 274 (Invalid argument passed). But I don't understand where I'm wrong. Is there anything else I need to use this function?
After open the Notepad I tried with :
SendKeys("Untitled - Notepad", "a");
and don't work it.