Jump to content

Recommended Posts

Posted

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

  • Moderators
Posted

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.

Posted (edited)

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
Posted

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.

  • Moderators
Posted

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.

Posted

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

  • Moderators
Posted

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.

Posted

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)

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
  • Recently Browsing   0 members

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