Jump to content

Hide / Show Desktop Icons


 Share

Recommended Posts

OK, got this:

#NoTrayIcon
$sfile="status.txt"
$fh=FileExists($sfile)

if $fh=1 Then
    $fo=fileopen($sfile,0)
    $status=FileReadLine($fo,1)
    FileClose($fo)
EndIf

;MsgBox(1,$status,"")

if $status="h" then 
   
    ControlShow("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")
    $fo=fileopen($sfile,2)
    FileWrite($fo," ")
    FileClose($fo)
    ;MsgBox(1,$status,"is h")
    
 Else
     
    ControlHide("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")
    $fo=fileopen($sfile,2)
    FileWriteLine($fo,"h")
    FileClose($fo)
    ;MsgBox(1,$status,"is blnk")
    
EndIf

FileClose($fo)

Which works - but you cannot right-click the desktop. Anyone know of a method where the desktop can be clicked?

Cheers

Steve

Link to comment
Share on other sites

  • Moderators

When you hide the control, it's moved off screen. Context menus are triggered when your mouse is over the icon and secondary button clicked. Unless you did a horrendous custom function to get the position of the control, copy it's menus, hide it, then watch to see if the mouse is ever over that area and if the secondary button is pressed or.. you replaced the icon for the app with an invisible one (no idea if that would even work) ... I would have no idea personally how to accomplish your task with just the above 2 obstacles.

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.

Link to comment
Share on other sites

Just threw this together.

#Include <GuiListView.au3>

HotKeySet("{esc}","captureEsc")
$exitvar = 0
$h = WinGetHandle("[CLASS:Progman]")
$hwnd = ControlGetHandle($h,"","SysListView321")
_GUICtrlListView_DeleteAllItems($hwnd)
Do
    $msg = GUIGetMsg()
Until $exitvar <> 0
ProcessClose("explorer.exe")
Run("explorer.exe")

Func captureEsc()
    $exitvar = 1
    HotKeySet("{esc}")
EndFunc

edit: not elegant but works....kinda. Icons re-appear when refresh occurs (but out of order). Testing copying icons to another listview control instead of killing explorer.exe process.

Edited by spudw2k
Spoiler

Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder
Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array
Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc
Cool Stuff: AutoItObject UDF â—Š Extract Icon From Proc â—Š GuiCtrlFontRotate â—Š Hex Edit Funcs â—Š Run binary â—Š Service_UDF

 

Link to comment
Share on other sites

Been thinking over night about this. Is there anyway to emulate:

right click desktop-> arrange desktop icons-> show desktop icons

Without right clicking or being on the desktop? Mind you this is very slow in hiding / unhiding, but allows a right click on the desktop.

Link to comment
Share on other sites

Send("#d")
MouseMove(@DesktopWidth,0,1)
MouseClick("right")
Send("ID")

Spoiler

Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder
Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array
Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc
Cool Stuff: AutoItObject UDF â—Š Extract Icon From Proc â—Š GuiCtrlFontRotate â—Š Hex Edit Funcs â—Š Run binary â—Š Service_UDF

 

Link to comment
Share on other sites

  • Moderators

Just had a question for I'm curious. This is a serious question. Why does one need to hide the icons? Would not a simple GUI that covered the desktop without a title bar do the trick? If I'm missing something, please clue me in. Thanks.

You missed the secondary button click request I think.

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.

Link to comment
Share on other sites

Been supplied with some code that when compiled with dev-c++ works and allows right clicking on desktop:

CODE
#include "windows.h"

int main()

{

HANDLE hWindow;

hWindow = FindWindowEx(0, 0, "Progman", 0);

hWindow = FindWindowEx(hWindow, 0, "SHELLDLL_DefView", 0);

PostMessage(hWindow, WM_COMMAND, 0x7402, 0);

return 0;

}

Not a c/c++ programmer, could this be converted to autoit???

Link to comment
Share on other sites

  • Moderators

Been supplied with some code that when compiled with dev-c++ works and allows right clicking on desktop:

CODE
#include "windows.h"

int main()

{

HANDLE hWindow;

hWindow = FindWindowEx(0, 0, "Progman", 0);

hWindow = FindWindowEx(hWindow, 0, "SHELLDLL_DefView", 0);

PostMessage(hWindow, WM_COMMAND, 0x7402, 0);

return 0;

}

Not a c/c++ programmer, could this be converted to autoit???
#Include <WinAPI.au3>
_main(0); Hide
Sleep(3000)
_main(); Show

Func _main($i_show = 1)
    Local $__WM_COMMAND = 0x00111
    Local $h_wnd = WinGetHandle("[CLASS:Progman]")
    $h_wnd = ControlGetHandle($h_wnd, "", "[CLASSNN:SHELLDLL_DefView1]")
    _WinAPI_PostMessage($h_wnd, $__WM_COMMAND, 0x7402, $i_show)
    Return 0
EndFunc

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.

Link to comment
Share on other sites

xircon

In pure AutoIt:

MsgBox(0, "Warning", "Now we hide desktop icons")
_ShowHideIcons(@SW_HIDE)

MsgBox(0, "Warning", "Now we show desktop icons")
_ShowHideIcons(@SW_SHOW)

Func _ShowHideIcons($sState)
    Local $hParent = WinGetHandle("Program Manager")
    Local $hListView = ControlGetHandle($hParent, "", "SysListView321")
    
    WinSetState($hListView, "", $sState)
EndFunc

;)

Link to comment
Share on other sites

This is slightly off topic, but a good accompliment to rasim's script displaying desktop effects.

This script from ProgAndy's post at

http://www.autoitscript.com/forum/index.ph...st&p=549959

makes Windows' desktop icons display in a list view on desktop.

Slightly modified version.

#include <GUIListView.au3>

; http://www.autoitscript.com/forum/index.php?s=&showtopic=75879&view=findpost&p=549959

$h = WinGetHandle("[CLASS:Progman]")
$hwnd = ControlGetHandle($h, "", "SysListView321")
_GUICtrlListView_SetView($hwnd, 3)

MsgBox(0, "", "Press OK to reset Desktop")

;$h = WinGetHandle("[CLASS:Progman]")
;$hwnd = ControlGetHandle($h, "", "SysListView321")
_GUICtrlListView_SetView($hwnd, 1)
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...