Jump to content
Sign in to follow this  
Alek

Scroll Desktop

Recommended Posts

Alek

here is a function that scrolls the desktop, might be usfull for the multi desktop application that i saw here a few days ago...

; #FUNCTION# ==============================================================================
; Description ...: Scrolls the desktop left, right, up or down
; Parameters ....: $S_Dir      - The directions to scroll, "Left", "Right", "Up" or "Down"
;                  $S_Speed    - The Scroll speed, 20 by default, 300 is the max speed
; Return values .: Returns 0 if error
; Author ........: Alek
; Remarks .......: Needs to have #include <A3LScreencap.au3> or _ScreenCap_Capture included
; =========================================================================================

Func _ScrollScreen($S_Dir,$S_Speed=20)
    if $S_Speed > 300 then $S_Speed = 300
    if $S_Speed < 0 then $S_Speed = 1
    Switch $S_Dir
        Case "Left"
             _ScreenCap_Capture(@TempDir & "\pix.bmp")
            $Gui = GuiCreate("", @DesktopWidth*2, @DesktopHeight,0, 0, 0x80000000,128)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,0,@DesktopWidth,@DesktopHeight)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",@DesktopWidth,0,@DesktopWidth,@DesktopHeight)
            GuiSetState()
            $S_Pos = WinGetPos($Gui)
            for $x = 0 to @DesktopWidth Step $S_Speed
                WinMove($Gui,"",$S_Pos[0]-$x,0)
                Sleep(1)
            Next
            WinMove($Gui,"",$S_Pos[0]-@DesktopWidth,0)
        Case "Right"
            _ScreenCap_Capture(@TempDir & "\pix.bmp")
            $Gui = GuiCreate("", @DesktopWidth*2, @DesktopHeight,0-@DesktopWidth, 0, 0x80000000,128)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,0,@DesktopWidth,@DesktopHeight)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",@DesktopWidth,0,@DesktopWidth,@DesktopHeight)
            GuiSetState()
            $S_Pos = WinGetPos($Gui)
            for $x = 0 to @DesktopWidth Step $S_Speed
                WinMove($Gui,"",$S_Pos[0]+$x,0)
                Sleep(1)
            Next
            WinMove($Gui,"",$S_Pos[0]+@DesktopWidth,0)
        Case "Up"
            _ScreenCap_Capture(@TempDir & "\pix.bmp")
            $Gui = GuiCreate("", @DesktopWidth, @DesktopHeight*2,0,0, 0x80000000,128)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,0,@DesktopWidth,@DesktopHeight)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,@DesktopHeight,@DesktopWidth,@DesktopHeight)
            GuiSetState()
            $S_Pos = WinGetPos($Gui)
            for $x = 0 to @DesktopHeight Step $S_Speed
                WinMove($Gui,"",0,$S_Pos[1]-$x)
                Sleep(1)
            Next
            WinMove($Gui,"",0,$S_Pos[1]-@DesktopHeight)
        Case "Down"
            _ScreenCap_Capture(@TempDir & "\pix.bmp")
            $Gui = GuiCreate("", @DesktopWidth, @DesktopHeight*2,0,0-@DesktopHeight, 0x80000000,128)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,0,@DesktopWidth,@DesktopHeight)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,@DesktopHeight,@DesktopWidth,@DesktopHeight)
            GuiSetState()
            $S_Pos = WinGetPos($Gui)
            for $x = 0 to @DesktopHeight Step $S_Speed
                WinMove($Gui,"",0,$S_Pos[1]+$x)
                Sleep(1)
            Next
            WinMove($Gui,"",0,$S_Pos[1]+@DesktopHeight)
        Case Else
            Return 0
    EndSwitch
    GUIDelete($Gui)
EndFuncoÝ÷ ØLZ^jëh×6#include <A3LScreencap.au3>

_ScrollScreen("Left",50)
_ScrollScreen("Up",50)
_ScrollScreen("Right",50)
_ScrollScreen("Down",50)

; #FUNCTION# ==============================================================================
; Description ...: Scrolls the desktop left, right, up or down
; Parameters ....: $S_Dir      - The directions to scroll, "Left", "Right", "Up" or "Down"
;                  $S_Speed    - The Scroll speed, 20 by default, 300 is the max speed
; Return values .: Returns 0 if error
; Author ........: Alek
; Remarks .......: Needs to have #include <A3LScreencap.au3> or _ScreenCap_Capture included
; =========================================================================================

Func _ScrollScreen($S_Dir,$S_Speed=20)
    if $S_Speed > 300 then $S_Speed = 300
    if $S_Speed < 0 then $S_Speed = 1
    Switch $S_Dir
        Case "Left"
             _ScreenCap_Capture(@TempDir & "\pix.bmp")
            $Gui = GuiCreate("", @DesktopWidth*2, @DesktopHeight,0, 0, 0x80000000,128)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,0,@DesktopWidth,@DesktopHeight)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",@DesktopWidth,0,@DesktopWidth,@DesktopHeight)
            GuiSetState()
            $S_Pos = WinGetPos($Gui)
            for $x = 0 to @DesktopWidth Step $S_Speed
                WinMove($Gui,"",$S_Pos[0]-$x,0)
                Sleep(1)
            Next
            WinMove($Gui,"",$S_Pos[0]-@DesktopWidth,0)
        Case "Right"
            _ScreenCap_Capture(@TempDir & "\pix.bmp")
            $Gui = GuiCreate("", @DesktopWidth*2, @DesktopHeight,0-@DesktopWidth, 0, 0x80000000,128)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,0,@DesktopWidth,@DesktopHeight)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",@DesktopWidth,0,@DesktopWidth,@DesktopHeight)
            GuiSetState()
            $S_Pos = WinGetPos($Gui)
            for $x = 0 to @DesktopWidth Step $S_Speed
                WinMove($Gui,"",$S_Pos[0]+$x,0)
                Sleep(1)
            Next
            WinMove($Gui,"",$S_Pos[0]+@DesktopWidth,0)
        Case "Up"
            _ScreenCap_Capture(@TempDir & "\pix.bmp")
            $Gui = GuiCreate("", @DesktopWidth, @DesktopHeight*2,0,0, 0x80000000,128)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,0,@DesktopWidth,@DesktopHeight)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,@DesktopHeight,@DesktopWidth,@DesktopHeight)
            GuiSetState()
            $S_Pos = WinGetPos($Gui)
            for $x = 0 to @DesktopHeight Step $S_Speed
                WinMove($Gui,"",0,$S_Pos[1]-$x)
                Sleep(1)
            Next
            WinMove($Gui,"",0,$S_Pos[1]-@DesktopHeight)
        Case "Down"
            _ScreenCap_Capture(@TempDir & "\pix.bmp")
            $Gui = GuiCreate("", @DesktopWidth, @DesktopHeight*2,0,0-@DesktopHeight, 0x80000000,128)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,0,@DesktopWidth,@DesktopHeight)
            GUICtrlCreatePic(@TempDir & "\pix.bmp",0,@DesktopHeight,@DesktopWidth,@DesktopHeight)
            GuiSetState()
            $S_Pos = WinGetPos($Gui)
            for $x = 0 to @DesktopHeight Step $S_Speed
                WinMove($Gui,"",0,$S_Pos[1]+$x)
                Sleep(1)
            Next
            WinMove($Gui,"",0,$S_Pos[1]+@DesktopHeight)
        Case Else
            Return 0
    EndSwitch
    GUIDelete($Gui)
EndFunc
Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites
Draygoes

Thats pretty cool. I know that im going to find a way to use it eventually. Good Job!!!


Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 

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  

×