Jump to content

Desktop -> View -> Small icons


Recommended Posts

Hello

AutoIt version: 3.3.14.2

1) Operating system: Microsoft Windows 7 Professional Service Pack 1 x64

2) User Account Control : OFF

How make : one click right button mouse on Desktop , View -> Small icons?

I need function or WinAPI method or DllCall method

For example I call function _Desktop_DefView_SetIconSz (4)

_Desktop_DefView_SetIconSz(4)

Func _Desktop_DefView_SetIconSz($hWnd, $iSize) ;$hwnd of DefView, $iSize 0-4 smallest to largest

    ;EXLARGEICONS=0, MEDICONS=1, LARGEICONS=2,SMALLICONS=3, SMALLESTICONS=4
    ;Made this up from watching Window Messages (fires menu messages I think)
    ;(IFolderView2::SetViewModeAndIconSize. is probably how WE should be doing this)
    If @OSVersion = "WIN_XP" Then Return 0
    ;Works on Windows 7/8, Sends icon size to defView based on ListView view

    If $iSize < 0 Or $iSize > 4 Or @OSVersion = "WIN_XP" Then Return 0
    Local $aLvtoDv[5] = [4, 3, 1, 2, 0]
    ;Extra Large Icons = &H704D -28749<-----Index 0
    ;Medium Icons = &H704E      -28750; Large Icons = &H704F       -28751;
    ;Small Icons = &H7050       -28752; Smallest Icons = &H7051    -28753

    Local Const $WM_COMMAND = 0x111
    Local $iMsg = $WM_COMMAND
    Local $wParam = 28749 + $aLvtoDv[Int($iSize)] ;FVM_??
    Local Const $lParam = 0
    _SendMessage($hWnd, $iMsg, $wParam, $lParam)
    If @error Then
        MsgBox(0, "_Desktop_DefView_SetIconSz", "_SendMessage Error: " & @error)
        Exit
    EndIf

    Return 1
EndFunc   ;==>_Desktop_DefView_SetIconSz

and Icons on Desktop was Small Icons

Thank You!

Edited by SharkyEXE
Link to comment
Share on other sites

i believe i found the api, in icon section, SPI_SETICONMETRICS but im not good enough to help further.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

  • Developers
51 minutes ago, SharkyEXE said:

Please write your code , maybe other users with your code write me function

We have made this clear to you in the past and will not happen., so please stop requesting this.
You just post bit of code which we can't test with and expect somebody to help you. Just think a little further than your own keyboard and I am sure you get much better help.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Earthshine

Hello!

I want help, that's why I turned to the community

Thank You! 

Jos

Hello!

I have write very very do not beautiful code , tshis code work

I need very very beautiful code, mini code, with WinAPI or DllCall

What need this forum if not helps for users?

Thank You!

$hWnd = WinGetHandle ( "[TITLE:Program Manager; CLASS:Progman]", "" )
$hControl = ControlGetHandle ( $hWnd, "", "[CLASS:SysListView32; INSTANCE:1]" )

WinActivate ( $hWnd, "" )

Sleep ( 1000 )

WinWaitActive ( $hWnd, "" )

Sleep ( 1000 )

WinSetOnTop ( $hWnd, "", 1 )

Sleep ( 1000 )

ControlFocus ( $hWnd, "", $hControl )
ControlClick ( $hWnd, "", $hControl, "right", 1, 0, 0 )

Sleep ( 2000 )

ControlFocus ( $hWnd, "", $hControl )
ControlSend ( $hWnd, "", $hControl, "{DOWN 1}" )

Sleep ( 2000 )

ControlFocus ( $hWnd, "", $hControl )
ControlSend ( $hWnd, "", $hControl, "{RIGHT}" )

Sleep ( 2000 )

ControlFocus ( $hWnd, "", $hControl )
ControlSend ( $hWnd, "", $hControl, "{DOWN 2}" )

Sleep ( 2000 )

ControlFocus ( $hWnd, "", $hControl )
ControlSend ( $hWnd, "", $hControl, "{ENTER}" )

Sleep ( 2000 )

 

Edited by SharkyEXE
Link to comment
Share on other sites

Im confused about this

"[CLASS:SysListView32; INSTANCE:1]" )

You seem to be trying to automate the context menu, but at the same time, you have this, that pertains the listview.

If you want it quick and dirty, then send instead of controlsend.

Now, for that you could go with something like this, but the mouse has to be in the desktop, or otherwise in a suitable place for the context menu to work.

#include <AutoItConstants.au3>
Sleep(3000)
MouseClick($MOUSE_CLICK_RIGHT)
Send("{DOWN 2}") ;2 for me because my context menu has another item on top.
Send("{RIGHT}")
Send("{ENTER}")
Sleep(3000) ;Wait and set back to medium
MouseClick($MOUSE_CLICK_RIGHT)
Send("{DOWN 2}") ;2 for me because my context menu has another item on top.
Send("{RIGHT}")
Send("{DOWN}")
Send("{ENTER}")

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

huh? anyway, i remembered that you could ctrl+mouse wheel to change the size too.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

This is as far as i went with trying this but it fails. Im bad at this, help from the experts needed. What am i missing?

#include <Array.au3>
#include <WinAPI.au3>
#include <WinAPIsysinfoConstants.au3>
#include <WindowsConstants.au3>

Local Const $tagICONMETRICS = "struct;uint cbSize;int iHorzSpacing;int iVertSpacing;int iTitleWrap;LOGFONT lfFont; endstruct"

GetWorkArea()

Func GetWorkArea()
    Local $IcoWork = DllStructCreate($tagICONMETRICS)
    Local $Params = _WinAPI_SystemParametersInfo($SPI_GETICONMETRICS, 'UINT', $IcoWork)
    ConsoleWrite(DllStructGetData($IcoWork, 'cbSize')&@CRLF)
EndFunc   ;==>GetWorkArea
;=============================================================================
#cs Comments:

;From help file of DllStructCreate

    Create the following structure (C language):
    struct {
        int var1;
        unsigned char var2;
        unsigned int var3;
        char var4[128];
    };

    Schema:
    ------------------------------------
    \ int    \ byte   \ uint   \ char   \
     \   var1 \   var2 \   var3 \   var4 \
      ------------------------------------
;=============================================================================

;From https://msdn.microsoft.com/en-us/library/windows/desktop/ms648054(v=vs.85).aspx

typedef struct tagICONMETRICS {
  UINT    cbSize;
  int     iHorzSpacing;
  int     iVertSpacing;
  int     iTitleWrap;
  LOGFONT lfFont;
} ICONMETRICS, *PICONMETRICS, *LPICONMETRICS;

#ce

btw  i know this is the GET and not the SET function. Trying to see if i can retrieve the size first.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

This should look Ok if "auto arrange" is checked   (Using CTRL + Zooming ..)
Here you can set the icons close to any size you wish

Global Const $MK_CONTROL = 0x8
Global Const $WM_MOUSEWHEEL = 0x020A
Global Const $WHEEL_POS = 0x00780000
Global Const $WHEEL_NEG = 0xff880000

Global $address = "HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop"
Global $hwnd = ControlGetHandle('[Class:Progman]', '', '[Class:SHELLDLL_DefView]')

Global $aSize[6] = [5, 16, 32, 48, 96, 128]

_SetIconSize(4) ; 1 = Tiny ; 2 = Small ; 3 = Meduim ; 4 = Large ; 5 = huge

Func _SetIconSize($size = 2)
    If $size > $aSize[0] Or $size <= 0 Then Exit
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $hwnd, "int", 0x111, "int", 28931, "int", 0)
    Local $icurrentSize = RegRead($address, "IconSize")
    If $aSize[$size] - $icurrentSize > 0 Then
        Do
            _Call($WHEEL_POS)
        Until RegRead($address, "IconSize") >= $aSize[$size]
    ElseIf $aSize[$size] + 5 < $icurrentSize Then
        Do
            _Call($WHEEL_NEG)
        Until RegRead($address, "IconSize") <= $aSize[$size] + 5
    EndIf
EndFunc   ;==>_SetIconSize

Func _Call($wparam)
    DllCall("user32.dll", "none", "SendMessageW", "hwnd", $hwnd, "uint", $WM_MOUSEWHEEL, "wparam", BitOR($MK_CONTROL, $wparam), "lparam", 0)
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $hwnd, "int", 0x111, "int", 28931, "int", 0)
EndFunc   ;==>_Call

 

Edited by Deye
Link to comment
Share on other sites

Deye

Hello

Thank yo very mauch for you method.

You method is extended for many views - from 0 to 5

Do you have micro code for work only View - Big Icons , View - Degault Icons , View - Small Icons

Such as

DllCall("user32.dll", "long", "SendMessage", "hwnd", $hwnd, "int", 0x111, "int", 28931, "int", 0)

or

WinAPI method

1 stroke or 2 stroke or 3 stroke

Thank You!

Edited by SharkyEXE
Link to comment
Share on other sites

The best way i can think of .. is this :

#include <WinAPISys.au3>
_WinAPI_SetForegroundWindow(_WinAPI_GetShellWindow())

_SetIconSize(2) ; 1 = Small ; 2 = Meduim ; 3 = Large

Func _SetIconSize($size = 2)
    Send("{APPSKEY}")
    Send("{down}")
    Send("{right}")
    If $size = 3 Then Return Send("{ENTER}")
    Send("{down}")
    If $size = 2 Then Return Send("{ENTER}")
    Send("{down}")
    If $size = 1 Then Return Send("{ENTER}")
EndFunc   ;==>_SetIconSize

 

Link to comment
Share on other sites

Deye

Hello

Thank yo very mauch for you method.

I very very need method DllCall or WinAPI in 1 stroke or 2 stroke such as

DllCall("user32.dll", "long", "SendMessage", "hwnd", $hwnd, "int", 0x111, "int", 28931, "int", 0)

Besause send may be do not work if on desktop was opene other windows

MayBe light version this , please corect this code

_Desktop_DefView_SetIconSz(4)

Func _Desktop_DefView_SetIconSz($hWnd, $iSize) ;$hwnd of DefView, $iSize 0-4 smallest to largest

    ;EXLARGEICONS=0, MEDICONS=1, LARGEICONS=2,SMALLICONS=3, SMALLESTICONS=4
    Local $aLvtoDv[5] = [4, 3, 1, 2, 0]
    ;Extra Large Icons = &H704D -28749<-----Index 0
    ;Medium Icons = &H704E      -28750; Large Icons = &H704F       -28751;
    ;Small Icons = &H7050       -28752; Smallest Icons = &H7051    -28753

    Local Const $WM_COMMAND = 0x111
    Local $iMsg = $WM_COMMAND
    Local $wParam = 28749 + $aLvtoDv[Int($iSize)] ;FVM_??
    Local Const $lParam = 0
    _SendMessage($hWnd, $iMsg, $wParam, $lParam)
    If @error Then
        MsgBox(0, "_Desktop_DefView_SetIconSz", "_SendMessage Error: " & @error)
        Exit
    EndIf

    Return 1
EndFunc   ;==>_Desktop_DefView_SetIconSz

Thank You!

Edited by SharkyEXE
Link to comment
Share on other sites

Undefined func

_Desktop_DefView_SetIconSz

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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...