Link to home
Start Free TrialLog in
Avatar of pamsauto
pamsauto

asked on

Capture Active window in vb.net

Does anyone have or has seen an example of how to find the current active window on a desktop, find its cordinates and then screen shot it in to a bmp?
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

There are two basic ways to go about it:

(1) Use the GetForegroundWindow() API to get a handle to the active window.  Use the GetWindowRect() API to get the screen coordinates.  Use the BitBlt() API to copy it to an image (more APIs involved there).

(2) Press Alt-PrtScr and copy the resulting Image from the ClipBoard.

Do you have a preference in method?...
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pamsauto
pamsauto

ASKER

I need method #1.  With the API calls you gave me I found what I needed.  They were solutions you made for users already!    

https://www.experts-exchange.com/questions/21504191/Finding-the-location-of-a-open-program-window-on-the-screen.html


As always Idle Mind - Thanks for your help.