Close tabs on exit button when minimize to tray enabled
Posted: 25 Aug 2026 10:54
Close all tabs and forget tree state on exit button when minimize to tray enabled, I use "minimize to tray" only so it opens quickly next time.
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
Code: Select all
focus "P1";
goto "%computer%";
tab("closeothers");
#484;
focus "P2";
goto "%computer%";
tab("closeothers");
#484;
focus "P1";
run """%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe"" -NoProfile -ExecutionPolicy Bypass -File ""C:\XyplorerExit.ps1"" <hwnd>";
Code: Select all
try {
Add-Type @'
using System;
using System.Runtime.InteropServices;
public class Win32 {
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(
IntPtr hWnd,
uint Msg,
IntPtr wParam,
IntPtr lParam
);
}
'@
$hwnd = [IntPtr]([Int64]$args[0])
Write-Host "HWND: $hwnd"
if ($hwnd -eq [IntPtr]::Zero) {
throw "Invalid HWND"
}
$result = [Win32]::SendMessage(
$hwnd,
0x0112,
[IntPtr]0xF060,
[IntPtr]0
)
Write-Host "Result: $result"
}
catch {
Write-Host ""
Write-Host "ERROR:" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
Write-Host ""
Write-Host $_.ScriptStackTrace
}