Sign in to follow this  
Followers 0
MCP

Desktop icons

7 posts in this topic

#1 ·  Posted (edited)

I would like to hide all the user icons on the desktop and to restore them.

I have extracted some pretty damn good code on this, but I cannot move the folders.

Has anyone already faced this goal? Any idea on where to start will be greatly appreciated.

This is what I am on now:

Func HideDesktopIcons()
    Local $handle = ControlGetHandle('Program Manager', '', 'SysListView321')
    Local $pos, _
            $name, _
            $iniDir = @AppDataDir & '\Uncover IT\' & GetUniversalAppName (), _
            $currentDesktop = 'default' 
    
    ;MsgBox(0, '', $iniDir & '\' & $currentDesktop & '.ini')
    FileDelete($iniDir & '\' & $currentDesktop & '.ini')
    DirCreate($iniDir & '\User Desktop')
    DirCreate($iniDir & '\System Desktop')
    For $i = 0 To _ListView_GetItemCount ($handle) - 1
        $pos = _ListView_GetItemPosition ($handle, $i)
        $name = _ListView_GetItemText ($handle, $i)
        IniWrite($iniDir & '\' & $currentDesktop & '.ini', 'Last Positions', $name, $pos[0] & '|' & $pos[1])
    Next
    FileMove(@DesktopDir & '\*.*', $iniDir & '\User Desktop')
    FileMove(@DesktopCommonDir & '\*.*', $iniDir & '\System Desktop')
    DirMove(@DesktopDir & '\*.*', $iniDir & '\User Desktop')
    DirMove(@DesktopCommonDir & '\*.*', $iniDir & '\System Desktop')
EndFunc   ;==>HideDesktopIcons
Func ShowDesktopIcons()
    Local $pos, _
            $name, _
            $iniDir = @AppDataDir & '\Uncover IT\' & GetUniversalAppName (), _
            $currentDesktop = 'default' 
    
    FileMove($iniDir & '\User Desktop' & '\*.*', @DesktopDir)
    FileMove($iniDir & '\System Desktop' & '\*.*', @DesktopCommonDir)
    DirMove($iniDir & '\User Desktop' & '\*.*', @DesktopDir)
    DirMove($iniDir & '\System Desktop' & '\*.*', @DesktopCommonDir)
    
    Local $handle = ControlGetHandle('Program Manager', '', 'SysListView321'), _
            $cords, $cordsSplit
    _ListView_BeginUpdate ($handle)
    For $i = 0 To _ListView_GetItemCount ($handle)
        $name = _ListView_GetItemText ($handle, $i)
        $cords = IniRead($iniDir & '\' & $currentDesktop & '.ini', 'Last Positions', $name, 'Unknown')
        $cordsSplit = StringSplit($cords, '|')
        
        If $cords <> 'Unknown'  Then
            _ListView_SetItemPosition32 ($handle, $i, $cordsSplit[1], $cordsSplit[2])
        Else
            IniDelete($iniDir & '\' & $currentDesktop & '.ini', 'Last Positions', $name)
        EndIf
    Next
    _ListView_EndUpdate ($handle)
EndFunc   ;==>ShowDesktopIcons

EDIT: Please take note that these two UDF work, but they haven't been thoroughly tested/adapted well. They are not ready to be published as regular UDFs on the Examples forum.

EDIT: I have now solved the problem. Look here.

Edited by MCP

Share this post


Link to post
Share on other sites



You could probably adapt something from my Multiple Desktops program... it's in my signature.

However, if you don't want to look through the code I'll give you the basic idea.

Save all the icon positions (there's a function for that in the Multiple Desktops code)

I move all the files to a different directory

That would be pretty much all you need. Restoring icons is done in my program too...


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

You could probably adapt something from my Multiple Desktops program... it's in my signature.

However, if you don't want to look through the code I'll give you the basic idea.

Save all the icon positions (there's a function for that in the Multiple Desktops code)

I move all the files to a different directory

That would be pretty much all you need. Restoring icons is done in my program too...

Thank you, I am studying your code as usual.

@others reading, I have got this link too.

Thank you. I will go deep in the code of both.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Wouldn't

ControlHide("[CLASS:WorkerW], "", "[CLASSNN:SysListView321]")
and then
ControlShow("[CLASS:WorkerW], "", "[CLASSNN:SysListView321]")

Be easier?

...

Hell, I don't even know if that would work.

Edit:

A better example, but still haven't tried it myself.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Wouldn't

ControlHide("[CLASS:WorkerW], "", "[CLASSNN:SysListView321]")
and then
ControlShow("[CLASS:WorkerW], "", "[CLASSNN:SysListView321]")

Be easier?

...

Hell, I don't even know if that would work.

Edit:

A better example, but still haven't tried it myself.

Unfortunately it does not work, no action seems to be taken (but I am a newbie).

Thanks for pointing out this approach too.

Share this post


Link to post
Share on other sites

Unfortunately it does not work, no action seems to be taken (but I am a newbie).

Thanks for pointing out this approach too.

This worked:
ControlHide("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")
Sleep(5000)
ControlShow("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

This worked:

ControlHide("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")
Sleep(5000)
ControlShow("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")
Nice. Thank you. As usual!

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