Jump to content

Recommended Posts

Posted

Hi guys,

I'm using this script to restart explorer.exe

#include <WinAPI.au3>
#include <WinAPISys.au3>

;Save icon positions (probably not needed since we are doing a graceful exit ..)
DllCall("shell32.dll", "none", "SHChangeNotify", "long", 0x8000000, "uint", BitOR(0x0, 0x1000), "ptr", 0, "ptr", 0)

;Close the explorer shell gracefully
$hSysTray_Handle = _WinAPI_FindWindow('Shell_TrayWnd', '')
_SendMessage($hSysTray_Handle, 0x5B4, 0, 0)

While WinExists($hSysTray_Handle)
    Sleep(500)
WEnd

_start_explorer()

While Not _WinAPI_GetShellWindow()
    Sleep(500)
WEnd

EnvUpdate()

; continue script

Exit

Func _start_explorer()
    $strComputer = "localhost"
    $objWMI = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    Local $objexplorer = $objWMI.Get("win32_process")
    $objexplorer.create("explorer.exe")
EndFunc   ;==>_start_explorer

thanks to user Deye

Is there a way to recover whatever previously open explorer window?

Thanks!

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