Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
in my WPF app, i am trying to do a screen capture of an active window that i drag to a drop target.
what i did so far is AllowDrop = true on a text box. if I drag any file from window explorer, it works, the dragEnter event got fired.
but when i drag an active window over to that text box, nothing happen as it is just like we drag an window and overlay over another window.

any advice please?
Posted
Comments
Nguyen.H.H.Dang 2-Jul-14 1:03am    
I think you must find which is Active Windows, then determine if that active windows is overlapping which your textbox
Member 10913673 2-Jul-14 1:38am    
I can use User32.GetForegroundWindow to get active window. i don't understand what you mean by overlapping my text box?
my question is how do i make the active window recognize as a drop source when i drag enter or drop.
Nguyen.H.H.Dang 2-Jul-14 2:05am    
You wanna take a Screen Capture of Active Window, right ? I think drag drop event cannot do this. So, if you can find how to detect if user MOVE active window TO your textbox, you can screen shot that window.

P/s: i think, capture a window's screen shot is an easy task, the hard part is determine WHEN to do that.

Sorry about the confusing, English is not my mother language :(
Member 10913673 2-Jul-14 3:37am    
yea man.. screen shot all that i got it work.
but like you mentioned, the hard part is I need to figure out how to trigger my textbox (or whatever control) that handle Drop event to call the screen capture code.
Nguyen.H.H.Dang 2-Jul-14 3:54am    
I'm not good at using WinAPI, but do you know how to detect if ActiveWindow's Bound is intersect with ApplicationWindow ? My idea is, check if Active window is ON (intersect with) application window, if TRUE get the active window location, calculate if that location is ON application window's textbox (sth like point to client). If TRUE, get screen shot.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900