fastest way to mirror screen?

Everything else that doesn't fall into one of the other PB categories.
dige
Addict
Addict
Posts: 1426
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

fastest way to mirror screen?

Post 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 :-)
"Daddy, I'll run faster, then it is not so far..."
dige
Addict
Addict
Posts: 1426
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: fastest way to mirror screen?

Post 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
"Daddy, I'll run faster, then it is not so far..."
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: fastest way to mirror screen?

Post 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
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
dige
Addict
Addict
Posts: 1426
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: fastest way to mirror screen?

Post 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
"Daddy, I'll run faster, then it is not so far..."
dige
Addict
Addict
Posts: 1426
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: fastest way to mirror screen?

Post 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
"Daddy, I'll run faster, then it is not so far..."
Post Reply