Page 1 of 1

fastest way to mirror screen?

Posted: Thu Nov 03, 2016 11:26 am
by dige
Hi folks, I have two monitors on my computer. These are configured as an extended desktop.
With a small tool I would like to duplicate the contents of the first monitor to the second monitor,
so the extended desktop remains as it is.

What would be the best / fastest variant to do this?

Code: Select all

    PrintWindow = GetFunction ( hLib , "PrintWindow" )
    CallFunctionFast( PrintWindow, hwnd, hdc, #Null )
or
     DeskDC = GetDC_(GetDesktopWindow_()) 
     BitBlt_(hdc, 0, 0, Width, Height, DeskDC, x, y, #SRCCOPY|#CAPTUREBLT) 

or

     ??
Thanks for any suggestions :-)

Re: fastest way to mirror screen?

Posted: Thu Nov 03, 2016 11:37 am
by dige
Like this?

Code: Select all

#CAPTUREBLT = $40000000; For layered Windows

Procedure Capture (x, y)
  Static DeskDC = 0
  hdc = StartDrawing(CanvasOutput(0))
    If hdc
      If DeskDC = 0
        DeskDC = GetDC_(GetDesktopWindow_()) 
      EndIf
      BitBlt_(hdc, 0, 0, 800, 600, DeskDC, x, y, #SRCCOPY|#CAPTUREBLT) 
      ;ReleaseDC_(GetDesktopWindow_(), DeskDC)
    EndIf
  StopDrawing()
EndProcedure

OpenWindow(0, 0, 0, 800, 600, "", #WS_OVERLAPPEDWINDOW)
CanvasGadget(0, 0, 0, 800, 600 )

Repeat
  Capture( DesktopMouseX(), DesktopMouseY())
Until WaitWindowEvent(10) = #PB_Event_CloseWindow

Re: fastest way to mirror screen?

Posted: Thu Nov 03, 2016 12:49 pm
by IdeasVacuum
Talking to yourself dige :mrgreen:

It could be that like me, nobody understands what it is you are trying to achieve, or more to the point, why.

If you want a mirror image of one screen on the other, how about setting it as the screen background/wallpaper?

Code by Sparkie: http://www.purebasic.fr/english/viewtopic.php?p=210909

Re: fastest way to mirror screen?

Posted: Thu Nov 03, 2016 1:52 pm
by dige
Hi, Sparkie thank you for your feedback :D

Does not seem so easy to explain.. mainly its just bit blit the view from one monitor to another
or like a magnifier blit a part of the desktop no another..

The reason is, on the second monitor is allways visible a presentation and only sometimes
shall the content from the first monitor also be visible on the second, is that better understandable?

Ciao dige

Re: fastest way to mirror screen?

Posted: Fri Nov 04, 2016 9:38 am
by dige
Its done.

Talking to myself again :wink: Seems that the combination BitBlit_() and CanvasGadget() is fast enough.
If someone is interessted in a simple screen mirror tool:

http://www.dbsthumb.de/Download/MirrorScreen.zip

Have fun :D