Sign in to follow this  
Followers 0
Nova

Mirror Screen

20 posts in this topic

I saw a program ages ago which allowed you to mirror your screens display.

It was used in a simple card game to try confuse the player.

For example look at your desktop, now imagine how that would look in a mirror.

Everything becomes backward, you startbar is on the right hand side of your screen, text is written from right to left etc etc.

It was just a really really cool little effect.

I was wondering if anyone knew of a dllcall I could use to create a simular effect ?

Share this post


Link to post
Share on other sites



My idea:

Read out every pixel and write it on the other side of the screen. You can use my PixelDraw-function for this.

global $pixeldraw
$pixeldraw = DLLCall("user32.dll","long","GetDC","hwnd",0)

Func PixelDraw($xcoord, $ycoord, $color)
  DllCall("gdi32","long","SetPixel", "long", $pixeldraw[0], "long", $xcoord, "long", $ycoord, "long", $color)
  If @error = 1 Then
     Return 0
  Else
     Return 1
  EndIf
EndFunc

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

Why not do something like this:

Func PixelDraw($xcoord, $ycoord, $color)
   Local $PixelDraw
   
   $PixelDraw = DLLCall("user32.dll","long","GetDC","hwnd",0)
   
   DllCall("gdi32","long","SetPixel", "long", $PixelDraw[0], "long", $xcoord, "long", $ycoord, "long", $color)
   If @error = 1 Then
      Return 0
   Else
      Return 1
   EndIf
EndFunc

?

Or even specify the hwnd, like so:

Func PixelDraw($XCoord, $YCoord, $Color, $hwnd="GetDC")
   Local $PixelDraw
   
   $PixelDraw = DLLCall("user32.dll","long",$hwnd,"hwnd",0)
   
   DllCall("gdi32","long","SetPixel", "long", $PixelDraw[0], "long", $XCoord, "long", $YCoord, "long", $Color)
   If @error = 1 Then
      Return 0
   Else
      Return 1
   EndIf
EndFunc

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

~

o:)

This is sure better :lmao:


[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

lol, didn't mean to put you on the spot.

It's a great function I'll be using it a lot :lmao:

I was actually going to do something like this, but assumed it was impossible.

[EDIT]

Can it draw anywhere? I just tried to put pixels specifically on notepad and it did not work...?

Edited by Insolence

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

lol, didn't mean to put you on the spot.

It's a great function I'll be using it a lot :lmao:

I was actually going to do something like this, but assumed it was impossible.

[EDIT]

Can it draw anywhere?  I just tried to put pixels specifically on notepad and it did not work...?

<{POST_SNAPBACK}>

I´m always happy to see how to improve my scripts. o:)

I created this function a while ago when I was messing around with DllCalls, so maybe that´s why it´s not the best :)

And thanks. But it is very slow. Maybe you should use DllOpen and DllClose if you draw many pixels.

Hmm, it should be able to draw pixels anywhere...

You should maybe use DrawRectangle(), because a pixel is very small :)

Func DrawRectangle($xstart, $ystart, $xend, $yend, $color)
  For $x = $xstart to $xend
     For $y = $ystart to $yend
        PixelDraw($x, $y, $color)
     Next
  Next
EndFunc
Edited by gosu

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

I will be drawing tons of pixels. Could you demonstrate how to do that, please?

My knowledge with DLLCall is practically nil.


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

doh! i was just creating a SetPixel func... its done, and i have a GetPixelThenBeep func too and im making a TransPixel and maybe a MaginfyPixel func too... :lmao:


FootbaG

Share this post


Link to post
Share on other sites

I will be drawing tons of pixels.  Could you demonstrate how to do that, please?

My knowledge with DLLCall is practically nil.

<{POST_SNAPBACK}>

DrawRectangle(600, 300, 750, 400, 0xFF0000)

You need my DrawRectangle function posted above for this. :lmao:


[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

There's no DLLOpen or Close in there?

EDIT:

Also when I made a rectangle, while it was building as soon as I did something it dissapeared...

EDIT #2:

While 1
   PixelDraw(500,500, 0x000000)
   PixelDraw(500,501, 0x000000)
   PixelDraw(500,502, 0x000000)
   PixelDraw(500,503, 0x000000)
   PixelDraw(500,504, 0x000000)
   Sleep(10)
WEnd

Seems to have fixed it, once whatever you're drawing to refreshes it dissapears... maybe we'll have to read memory to update, or something similar?

EDIT #3:

Global $PixelDraw

PixelDrawConstruct($PixelDraw)

DrawRectangle(500, 500, 600, 600, 0x000000)

Func PixelDrawConstruct(ByRef $DLLHandle, $hwnd = "GetDC")
   $DLLHandle = DLLCall("user32.dll","long",$hwnd,"hwnd",0)
EndFunc

Func PixelDraw($DLLHandle, $XCoord, $YCoord, $Color, $hwnd="GetDC")
   DllCall("gdi32","long","SetPixel", "long", $DLLHandle[0], "long", $XCoord, "long", $YCoord, "long", $Color)
   If @error = 1 Then
      Return 0
   Else
      Return 1
   EndIf
EndFunc

Func DrawRectangle($xstart, $ystart, $xend, $yend, $color)
  For $x = $xstart to $xend
     For $y = $ystart to $yend
        PixelDraw($PixelDraw, $x, $y, $color)
     Next
  Next
EndFunc

Is my current progress...

Edited by Insolence

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

if u put a window over the pixels drawn or anything of that category, they dissapear :lmao:


FootbaG

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Yes, that's why I redraw it.

Edited by Insolence

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

Im not trying to mirror a static image like a screen shot.

Im trying to mirror my monitors output.

Share this post


Link to post
Share on other sites

Im not trying to mirror a static image like a screen shot.

Im trying to mirror my monitors output.

<{POST_SNAPBACK}>

So? Where´s the problem?

You just read out a pixel on the other side and draw it on the other side.

$asdf = PixelGetColor(0,0)
PixelDraw(1024,768,$asdf)

You need 2 for-loops to do that for the whole screen. But I see no sense in this.

I dont think there is a Dll which has got a function to mirror the screen.


[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Opt( "ColorMode", 1)

Dim $width = @DesktopWidth ,$height = @DesktopHeight , _
$creenShot[$width] [$height] , $pixeldraw = DLLCall("user32.dll","long","GetDC","hwnd",0)

For $ix = 0 to $width - 1
    For $iy = 0 to $height - 1
        $creenShot[$ix] [$iy] = PixelGetColor ( $ix, $iy)
    Next
Next

_Beep(2200,500)

$dll = DllOpen ( "gdi32.dll" )

For $ix = $width - 1 to 0 step -1
    For $iy = 0 to $height - 1
        pd( $ix, $iy, $creenShot[($width - 1) - $ix] [$iy])
    Next
Next

_Beep(4000,500)



DllClose ( $dll )






Func pd($XCoord, $YCoord, $Color)
   DllCall("gdi32.dll","long","SetPixel", "long", $pixeldraw[0], "long", $XCoord, "long", $YCoord, "long", $Color)
EndFunc


Func _Beep($Frequency, $Duration)
   DllCall ("kernel32.dll", "long", "Beep", "long", $Frequency, "long", $Duration)
EndFunc

Just something wrong with color :lmao:

Edit:Opt("ColorMode",1) :">

Edited by UP NORTH

Share this post


Link to post
Share on other sites

Great job UP NORTH. I just saw this topic and tried out your script. It works great.

Ian


"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites

Opt("ColorMode",1)


Dim $width = @DesktopWidth ,$height = @DesktopHeight , _
$creenShot[$width] [$height] , $pixeldraw = DLLCall("user32.dll","long","GetDC","hwnd",0) , _
$step = Inputbox(" " , "Pick the step.") , $dll = DllOpen ( "gdi32.dll" )


For $ix = 0 to $width - 1 step $step
    For $iy = 0 to $height - 1 step $step
        $creenShot[$ix] [$iy] = PixelGetColor ( $ix, $iy)
    Next
Next

_Beep(2200,500)

For $ix = $width - 1 to 0 step ("-" & $step)
    For $iy = 0 to $height - 1 step $step
        pd( $ix, $iy, $creenShot[($width - 1) - $ix] [$iy])
    Next
Next

_Beep(4000,500)
DllClose ( $dll )


Func pd($XCoord, $YCoord, $Color)
   DllCall("gdi32.dll","long","SetPixel", "long", $pixeldraw[0], "long", $XCoord, "long", $YCoord, "long", $Color)
EndFunc

Func _Beep($Frequency, $Duration)
   DllCall ("kernel32.dll", "long", "Beep", "long", $Frequency, "long", $Duration)
EndFunc
Try step 2 :lmao:

Share this post


Link to post
Share on other sites

@UP NORTH Nothing appears to happen when I run your script.

Is the above code a working example ?

Share this post


Link to post
Share on other sites

I'm not sure, but I think I may have had to press 'Print Screen' to make the script start...

Ian


"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

@UP NORTH Nothing appears to happen when I run your script.

Is the above code a working example ?

<{POST_SNAPBACK}>

Yes. here is a realtime mirror useing larry's MAGNIFY script. might not work in for the whole screen...

Global $SRCCOPY = 0x00CC0020
Global $leave = 0 , $dll[3] , $size = 100

HotKeySet("{PAUSE}","leave")


$dll[1] = DllOpen ( "user32.dll")
$dll[2] = DllOpen ( "gdi32.dll")


While Not $leave
  Sleep(25)
  MAG()
WEnd

DllClose ( $dll[1] )
DllClose ( $dll[2] )

Func MAG()
  $DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0)
  If Not @error Then
     $xy = MouseGetPos()
     If Not @error Then
        DLLCall("gdi32.dll","int","StretchBlt","int",$DeskHDC[0],"int",_
                    0,"int",0,"int",$size,"int",$size,"int",$DeskHDC[0],"int",_
                    $xy[0] + $size,"int",$xy[1],"int", "-" & $size ,"int", $size,_
                    "long",$SRCCOPY)
     EndIf
     DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0)
  EndIf
EndFunc

Func leave()
  $leave = 1
EndFunc

http://www.autoitscript.com/fileman/users/public/2151/files/4%20mirrors.au3

Edited by UP NORTH

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0