Jump to content

Desktop View Changer


Recommended Posts

This will change the view of the desktop (folder views)

You need Auto3Lib =>

http://www.autoitscript.com/forum/index.php?showtopic=33677

#Include <Constants.au3>
#Include <A3LListView.au3>
#Include <misc.au3>
#NoTrayIcon
Opt( "TrayAutoPause", 0 )
Opt("TrayMenuMode",1)
Opt("WinTitleMatchMode", 4)

$hWnd = ControlGetHandle( "Program Manager", "", "SysListView321" )

$detailsitem    = TrayCreateItem("Details")
$largeitem    = TrayCreateItem("Large Icons")
$smallitem    = TrayCreateItem("Small Icons")
$tileitem    = TrayCreateItem("Tile")
TrayCreateItem("")
$exititem       = TrayCreateItem("Exit")

TraySetState()
$view = _ListView_GetView($hWnd)
Select
    Case $view = 0
        TrayItemSetState( $detailsitem, $TRAY_CHECKED )
    Case $view = 1
        TrayItemSetState( $largeitem, $TRAY_CHECKED )
    Case $view = 2
        TrayItemSetState( $smallitem, $TRAY_CHECKED )
    Case $view = 4
        TrayItemSetState( $tileitem, $TRAY_CHECKED )
EndSelect

TrayItemSetState( $detailsitem, $TRAY_UNCHECKED)

While 1
    $msg = TrayGetMsg()
    Switch $msg
        Case 0
            ContinueLoop
        Case $exititem
            ExitLoop
        Case $detailsitem
            resettray()
            TrayItemSetState( $detailsitem, $TRAY_CHECKED)
            _ListView_SetView($hWnd, 0)
            _ListView_SetExtendedListViewStyle($hWnd, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP))
            DllCall("user32.dll", "long", "SendMessage", "hwnd", WinGetHandle("classname=Progman"), "int", 0x111, "int", 28931, "int", 0)
        Case $largeitem
            resettray()
            TrayItemSetState( $largeitem, $TRAY_CHECKED)
            _ListView_SetView($hWnd, 1)
            hidescrollbars($hWnd)
        Case $smallitem
            resettray()
            TrayItemSetState( $smallitem, $TRAY_CHECKED)
            _ListView_SetView($hWnd, 3)
            hidescrollbars($hWnd)
        Case $tileitem
            resettray()
            TrayItemSetState( $tileitem, $TRAY_CHECKED)
            _ListView_SetView($hWnd, 4)
            hidescrollbars($hWnd)
    EndSwitch
WEnd
Exit

Func resettray()
    TrayItemSetState( $detailsitem, $TRAY_UNCHECKED)
    TrayItemSetState( $largeitem, $TRAY_UNCHECKED)
    TrayItemSetState( $smallitem, $TRAY_UNCHECKED)
    TrayItemSetState( $tileitem, $TRAY_UNCHECKED)
EndFunc

Func hidescrollbars($hWnd)
    DllCall("user32.dll", "int", "ShowScrollBar", "hwnd", $hWnd, "int", 0, "int", False)
    DllCall("user32.dll", "int", "ShowScrollBar", "hwnd", $hWnd, "int", 1, "int", False)
EndFunc
Edited by CyberZeroCool

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

resolution changer?

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Thanks PartyPooper for code

:)

#Include <Constants.au3>
#Include <A3LListView.au3>
#Include <misc.au3>
#NoTrayIcon
Opt( "TrayAutoPause", 0 )
Opt("TrayMenuMode",1)
Opt("WinTitleMatchMode", 4)

Global $desktopHdefault= @DesktopHeight
Global $desktopWdefault= @DesktopWidth

$hWnd = ControlGetHandle( "Program Manager", "", "SysListView321" )

$detailsitem    = TrayCreateItem("Details")
$largeitem    = TrayCreateItem("Large Icons")
$smallitem    = TrayCreateItem("Small Icons")
$tileitem    = TrayCreateItem("Tile")
$menu = TrayCreateMenu("Resolution")
$_resolution1 = TrayCreateItem("640x480", $menu)
$_resolution2 = TrayCreateItem("800x600", $menu)
$_resolution3 = TrayCreateItem("1024x768", $menu)
$_resolution4 = TrayCreateItem("1280x1024", $menu)
$_resolution5 = TrayCreateItem("1600x1200", $menu)

$exititem      = TrayCreateItem("Exit")

TraySetState()
$view = _ListView_GetView($hWnd)
Select
    Case $view = 0
        TrayItemSetState( $detailsitem, $TRAY_CHECKED )
    Case $view = 1
        TrayItemSetState( $largeitem, $TRAY_CHECKED )
    Case $view = 2
        TrayItemSetState( $smallitem, $TRAY_CHECKED )
    Case $view = 4
        TrayItemSetState( $tileitem, $TRAY_CHECKED )
EndSelect

TrayItemSetState( $detailsitem, $TRAY_UNCHECKED)

While 1
    $msg = TrayGetMsg()
    Switch $msg
        Case 0
            ContinueLoop
        Case $exititem
            ExitLoop
        Case $_resolution1
            _ChangeScreenRes(640,480)
            _confirmResolution()
        Case $_resolution2
            _ChangeScreenRes(800,600)
            _confirmResolution()
        Case $_resolution3
            _ChangeScreenRes(1024,768)
            _confirmResolution()
        Case $_resolution4
            _ChangeScreenRes(1280,1024)
            _confirmResolution()
        Case $_resolution5
            _ChangeScreenRes(1600,1200)
            _confirmResolution()
        Case $detailsitem
            resettray()
            TrayItemSetState( $detailsitem, $TRAY_CHECKED)
            _ListView_SetView($hWnd, 0)
            _ListView_SetExtendedListViewStyle($hWnd, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP))
            DllCall("user32.dll", "long", "SendMessage", "hwnd", WinGetHandle("classname=Progman"), "int", 0x111, "int", 28931, "int", 0)
        Case $largeitem
            resettray()
            TrayItemSetState( $largeitem, $TRAY_CHECKED)
            _ListView_SetView($hWnd, 1)
            hidescrollbars($hWnd)
        Case $smallitem
            resettray()
            TrayItemSetState( $smallitem, $TRAY_CHECKED)
            _ListView_SetView($hWnd, 3)
            hidescrollbars($hWnd)
        Case $tileitem
            resettray()
            TrayItemSetState( $tileitem, $TRAY_CHECKED)
            _ListView_SetView($hWnd, 4)
            hidescrollbars($hWnd)
    EndSwitch
WEnd
Exit

Func _confirmResolution()
    if MsgBox(260,"Confirm","Confirm this resolution?",10) <> 6 Then
        _ChangeScreenRes($desktopWdefault,$desktopHdefault)
    EndIf   
EndFunc

Func resettray()
    TrayItemSetState( $detailsitem, $TRAY_UNCHECKED)
    TrayItemSetState( $largeitem, $TRAY_UNCHECKED)
    TrayItemSetState( $smallitem, $TRAY_UNCHECKED)
    TrayItemSetState( $tileitem, $TRAY_UNCHECKED)
EndFunc

Func hidescrollbars($hWnd)
    DllCall("user32.dll", "int", "ShowScrollBar", "hwnd", $hWnd, "int", 0, "int", False)
    DllCall("user32.dll", "int", "ShowScrollBar", "hwnd", $hWnd, "int", 1, "int", False)
EndFunc


;===============================================================================
;
; Function Name:    _ChangeScreenRes()
; Description:      Changes the current screen geometry, colour and refresh rate.
; Version:          1.0.0.1
; Parameter(s):     $i_Width - Width of the desktop screen in pixels. (horizontal resolution)
;                   $i_Height - Height of the desktop screen in pixels. (vertical resolution)
;                   $i_BitsPP - Depth of the desktop screen in bits per pixel.
;                   $i_RefreshRate - Refresh rate of the desktop screen in hertz.
; Requirement(s):   AutoIt Beta > 3.1
; Return Value(s):  On Success - Screen is adjusted, @ERROR = 0
;                   On Failure - sets @ERROR = 1
; Forum(s):         http://www.autoitscript.com/forum/index.php?showtopic=20121
; Author(s):        Original code - psandu.ro
;                   Modifications - PartyPooper
;
;===============================================================================
Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh)
    Local Const $DM_PELSWIDTH = 0x00080000
    Local Const $DM_PELSHEIGHT = 0x00100000
    Local Const $DM_BITSPERPEL = 0x00040000
    Local Const $DM_DISPLAYFREQUENCY = 0x00400000
    Local Const $CDS_TEST = 0x00000002
    Local Const $CDS_UPDATEREGISTRY = 0x00000001
    Local Const $DISP_CHANGE_RESTART = 1
    Local Const $DISP_CHANGE_SUCCESSFUL = 0
    Local Const $HWND_BROADCAST = 0xffff
    Local Const $WM_DISPLAYCHANGE = 0x007E
    If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth ; default to current setting
    If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight ; default to current setting
    If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth ; default to current setting
    If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh ; default to current setting
    Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]")
    Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE))
    If @error Then
        $B = 0
        SetError(1)
        Return $B
    Else
        $B = $B[0]
    EndIf
    If $B <> 0 Then
        DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5)
        DllStructSetData($DEVMODE, 4, $i_Width, 2)
        DllStructSetData($DEVMODE, 4, $i_Height, 3)
        DllStructSetData($DEVMODE, 4, $i_BitsPP, 1)
        DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5)
        $B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST)
        If @error Then
            $B = -1
        Else
            $B = $B[0]
        EndIf
        Select
            Case $B = $DISP_CHANGE_RESTART
                $DEVMODE = ""
                Return 2
            Case $B = $DISP_CHANGE_SUCCESSFUL
                DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY)
                DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _
                        "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width)
                $DEVMODE = ""
                Return 1
            Case Else
                $DEVMODE = ""
                SetError(1)
                Return $B
        EndSelect
    EndIf
EndFunc ;==>_ChangeScreenRes
Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key
Link to comment
Share on other sites

Cool man

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Wow, this is a cool Script. :)

I think..

What is with the Desktop Icon? (for any Desktop)

Sorry my english is bad.

look at this... Thread

Link:

It just changes the way your icons look on the desktop. so they can be listed or small icons or tiled

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

nice job ppl

I have one question

how does the script refreshes the view directly?

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

nice job ppl

I have one question

how does the script refreshes the view directly?

it only needs to with the detailed view because it lags but the command is:

DllCall("user32.dll", "long", "SendMessage", "hwnd", WinGetHandle("classname=Progman"), "int", 0x111, "int", 28931, "int", 0)

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...