Welcome! Log In Create A New Profile

Advanced

[WD22] Screenshot from a internal window

Posted by Michael Drechsel 
[WD22] Screenshot from a internal window
May 17, 2021 09:48AM
Hi,

I have an internal window which is greater than the parent window. I need a screenshot from the internal window (for printing purposes).

I try

Restore(WIN_Plan_Workflow_Schema)

WIN_Plan_Workflow_Schema..Width=WIN_Plan_Workflow_Schema.IWC_Workflow..UsefulWidth+100
WIN_Plan_Workflow_Schema..Height=WIN_Plan_Workflow_Schema.IWC_Workflow..UsefulHeight+200


MyImage is Image = dCopyWindowImage(WIN_Plan_Workflow_Schema)

Maximize(WIN_Plan_Workflow_Schema)


But unfortunately it shows only the visible part of the screen. Is there any way to get a image from the whole window (which ist greater than the screen width ?

regards Michael



Edited 1 time(s). Last edit at 05/17/2021 09:48AM by Michael Drechsel.
Marc De Swert
Re: [WD22] Screenshot from a internal window
June 09, 2021 09:02AM
Hi Michael,

Sorry for the late answer, but i am retired and read not often the forum anymore

but mayby this can help, just give it a try

greetings Marc.



Create a global variable gv_EventPrint is int

On the screen:
I place on plane 10 an hidden image called: IMG_ScreenPrint
In the global declarations of the screen:
gv_EventPrint = Event(StringBuild(MyWindow..Name + ".lp_CheckKey"), "*.*", WM_KEYDOWN)


when you take control of that screen and press the <F12> button the local procedure in that screen starts:

FUNCTION lp_CheckKey(p_Mess is int , p_Par1 is int , p_Par2 is int )
p_Mess = 0
p_Par2 = 0

EndEvent(gv_EventPrint)
SWITCH p_Par1
CASE 112 //Functietoets <F1> ingedrukt
SWITCH gW_Mode
CASE "B" // BROWSE
CASE "A" // ADD
WHelp(StringBuild(gv_DirectoryHelpFile + "Help_RIETVELDE.CHM"), 32)
CASE "D" // DELETE
WHelp(StringBuild(gv_DirectoryHelpFile + "Help_RIETVELDE.CHM"), 60)
CASE "M" // MODIFY
WHelp(StringBuild(gv_DirectoryHelpFile + "Help_RIETVELDE.CHM"), 48)
OTHER CASE
END
CASE 113 //Functietoets <F2> ingedrukt
Open(Dorinda_Info)
CASE 114 //Functietoets <F3> ingedrukt
CASE 115 //Functietoets <F4> ingedrukt
CASE 116 //Functietoets <F5> ingedrukt
CASE 117 //Functietoets <F6> ingedrukt
CASE 118 //Functietoets <F7> ingedrukt
CASE 119 //Functietoets <F8> ingedrukt
CASE 120 //Functietoets <F9> ingedrukt
CASE 121 //Functietoets <F10> ingedrukt
CASE 122 //Functietoets <F11> ingedrukt
CASE 123 //Functietoets <F12> ingedrukt
gp_PrintScreenLandscape(Handle(),StringBuild(MyWindow..Name + ". IMG_ScreenPrint") , True )
END
gv_EventPrint = Event(StringBuild(MyWindow..Name + ".lp_CheckKey"), "*.*", WM_KEYDOWN)



the global function gp_PrintScreenLandscape:
PROCEDURE gp_PrintScreenLandscape(p_Hand is int, p_ImageName is string = "Name.bmp", p_Screenshot is boolean = True )
LOCAL
l_Temp is string
l_Handle, l_Res are int

Multitask(1)
{p_ImageName}..Height = WinInHeight()
{p_ImageName}..Width = WinInWidth()
IF NOT dCopyBlt(copyScreen, p_ImageName, copySrcCopy, WinInXPos(), WinInYPos(), WinInHeight(), WinInWidth()) THEN
Error("Geen scherminformatie gevonden om af te drukken.")
ELSE
l_Temp = fRĂ©pertoireTemp()+"SchermAfdruk.bmp"
dSaveImageBMP(p_ImageName, l_Temp)
l_Handle = p_Hand

l_Res = CallDLL32("user32", "OpenClipboard", l_Handle)
IF l_Res = 0 THEN
Info("Probleem bij het openen van het clibbord")
ELSE
l_Res = CallDLL32("user32","EmptyClipboard")
IF l_Res = 0 THEN Info("calldll probleem bij EmptyClipboard")
l_Res = CallDLL32("user32", "SetClipboardData", 2, p_ImageName)
IF l_Res = 0 THEN Info("calldll probleeem bij SetClipboard")
l_Res = CallDLL32("user32", "CloseClipboard")
IF l_Res = 0 THEN Info("calldll probleem bij CloseClipboard")
//Printer op Landscape zetten en Dialoogbox voor printersetup laten zien

IF iParameter("ORIENTATION=LANDSCAPE") THEN
IF p_Screenshot THEN
iPreview()
iPrintImage(l_Temp, 0, 0, 287, 201)
iEndPrinting
END
END
END

END
{p_ImageName}..Height = 40
{p_ImageName}..Width = 40
{p_ImageName} = ""
Argus
Re: [WD22] Screenshot from a internal window
June 09, 2021 03:35PM
a simple way would be to temporarily increase the size of the main window, the internal window field so that the whole thing is displayed, then do your copy, and reset everything....

I suppose that you could even do that while putting the window outside the screen coordinates, so that it's not visible
Re: [WD22] Screenshot from a internal window
June 10, 2021 09:31PM
Hi Marc,

thx. What does your code different to my code ?

@Argus:

Nope, increasing the window does´nt help. I tried this manually with 2 Screens. I can see the window, but it takes only the part from the first screen and a half from the second with a black frame.

regards Michael
Argus
Re: [WD22] Screenshot from a internal window
June 11, 2021 01:36PM
manually on two screens, and by code OUTSIDE screen (ie NOT on 2 DIFFERENT screens) may have a completely different result
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: