Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Clone Active Window


  • Please log in to reply
5 replies to this topic
Person93
  • Members
  • 443 posts
  • Last active: Feb 11 2014 12:07 AM
  • Joined: 26 Jan 2012
Hi all,

I am trying to make a scrip that makes a window which always displays the contents of the window. I intend to use it for a computer with two monitors, I will turn one monitor towards someone else so they can see what I am doing.

I have an idea for this but there are some things that I need some help with.

1. Is there a way to take a screenshot to a variable instead of to the clipboard? (I don't want to touch the clipboard at all, because the script will take screenshots several times a second and I want the user to have regular access to the clipboard.)

If this is not possible, is there a way to lock the clipboard so that no other app or service can access it while the script is using it?

2. Is there a way to display an image (in a gui) from the clipboard or from a variable?

Thanks

Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009
Some systems allow one monitor to 'mirror' another existing monitor.
I suggest looking at adjustments for extended desktop.

If that is doesn't work, I suggest using google to search the forum
site:autohotkey.com livewindows

There are a few threads, this one seems interesting
"An updated LiveWindows (which can also show video)"

Sean wrote a script "ScreenCapture" that can save thumbnails.
<!-- m -->http://www.autohotke... ... eencapture<!-- m -->

But you would need to write a script to call the capture repeatedly and display the image in a gui.

>>is there a way to lock the clipboard so that no other app or service can access it while the script is using it?

I don't think so.

CodeKiller
  • Members
  • 2067 posts
  • Last active: Feb 26 2016 09:30 AM
  • Joined: 10 Jul 2008
For the clipboard thing just save the regular content each time the user make a copy/paste and when the script use it just replace the content with the regular content.

Person93
  • Members
  • 443 posts
  • Last active: Feb 11 2014 12:07 AM
  • Joined: 26 Jan 2012

For the clipboard thing just save the regular content each time the user make a copy/paste and when the script use it just replace the content with the regular content.


I usually do that, but I am if the script is constantly accessing the clipboard, (at least 10 times a second) it may interfere with normal clipboard use.

Some systems allow one monitor to 'mirror' another existing monitor.
I suggest looking at adjustments for extended desktop.


That sounds like a good idea, but I don't always work on the same computer.


I wrote this code to try cloning just the active window but it doesn't seem to be working.
#NoEnv
#SingleInstance force

f12::
win := WinActive()
Gui, New, +hwndhwnd +Resize, Window Clone
DC := DllCall("User32.dll\GetDC", "UPtr", hwnd) ;gets device context
MsgBox,,GetDC, % Errorlevel ;debugging tool
Error := DllCall("User32.dll\PrintWindow", "UInt", win, "Ptr", DC, "Str", "PW_CLIENTONLY") ;copies window
MsgBox,,PrintWindow, % Errorlevel A_Space Error ;debugging tool
Error := DllCall("User32.dll\ReleaseDC", "UInt", win, "Ptr", DC) ;release device context
MsgBox,, ReleaseDC, % Errorlevel A_Space Error ;debugging tool
return

Can you guys tell me what I am doing wrong?

Thanks for your tips and ideas. :)

noname
  • Members
  • 650 posts
  • Last active:
  • Joined: 12 Nov 2011
For ahk_l

f12::
win := WinActive("A")
wingetpos,,,w,h,ahk_id %win%
Gui, New, +hwndhwnd +Resize, Window Clone
gui, show ,w%w% h%h%
DC := DllCall("User32.dll\GetDC", "Ptr", hwnd) ;gets device context

settimer,redraw,50
return

redraw:
DllCall("User32.dll\PrintWindow", "Ptr", win, "Ptr", DC, "UInt", 0) ;copies window
return


esc::
guiclose:
DllCall("gdi32.dll\DeleteDC", "Ptr",DC )
exitapp

winXP  and ahk unicode


lblb
  • Guests
  • Last active:
  • Joined: --
Hi Person93,

Have you looked at Leef_Me's sugestions? If I understand your question correctly, the LiveWindows script that he suggested does exactly what you want (it's actually using Aeropeek in Vista/Win 7). It allows you to "film in real time" any window you want and show a replica in a Gui that you can move around. I've used it a bit for a few different things and it works very well.