ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 CaptureFromScreen from handle fails sometimes

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
jrpcguru Posted - Jul 31 2020 : 14:52:47
I am using:

WindowHandle := FindWindow(nil,pChar(sTitleBar)); 
ImageEnView1.IO.CaptureFromScreen(iecsSpecifiedWindow,crDefault, WindowHandle);    


sTitleBar contains the title bar name for a window. This code works as expected for normal program windows. But fails if the desired window is the Win 10 Settings dialog, Windows Calculator, Windows Character Map. My code correctly identifies the title bar and obtains a Windows handle for those dialogs but CaptureFromScreen fails. Alt+PrtSc key combination does capture these windows. I haven't succeeded in researching what the difference is for these types of windows.

J.R.
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 10 2020 : 22:38:45
Hi JR

Yes, the overlapping is a documented side effect (feature???) of iecsSpecifiedWindow2, but I will add SetForegroundWindow to the example in the help file, thanks.

Nigel
Xequte Software
www.imageen.com
jrpcguru Posted - Aug 10 2020 : 11:28:43
It would seem I was incorrect. The Character Map and the Snipping Tool don't even show in a list of windows so no handle is available. Once you actually snip something, then it gets a handle.

The Calculator, Windows Settings, and Snip & Sketch all have handles and do not screen capture with iecsSpecifiedWindow but they do work with iecsSpecifiedWindow2. I don't find iecsSpecifiedWindow2 mentioned in the help file, but it seems to work with all normal windows that have handles - so far.

Another detail. Your sample code in the help file includes:

WindowHandle := FindWindow(nil,pChar(sTitleBar));


In addition it needs:

SetForegroundWindow(WindowHandle);


Otherwise, if the desired window is on top of the ImageEn program, screen capture grabs its own program, not the desired window. I wonder if you intended ScreenCapture to automatically do this?



J.R.
xequte Posted - Aug 03 2020 : 22:36:42
Hi JR

Yes, for those types of windows, you need to use iecsSpecifiedWindow2.

Nigel
Xequte Software
www.imageen.com