Create a gist now

Instantly share code, notes, and snippets.

@gioxx /ShowReminder.ps1 Secret
Created Apr 12, 2017

What would you like to do?
Genera una MessageBox (Visual Basic) per mostrare a video un testo di "promemoria".
param (
[Parameter(Mandatory=$true)]
[String]$MsgTitle,
[Parameter(Mandatory=$true)]
[String]$MsgText
)
Add-Type -AssemblyName Microsoft.VisualBasic
$showWindowAsync = Add-Type –memberDefinition @”
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru
function Show-PowerShell() { [void]$showWindowAsync::ShowWindowAsync((Get-Process –id $pid).MainWindowHandle, 10) }
function Hide-PowerShell() { [void]$showWindowAsync::ShowWindowAsync((Get-Process –id $pid).MainWindowHandle, 2) }
Clear-Host
Hide-PowerShell
$MsgBox = [Microsoft.VisualBasic.Interaction]
[void] $MsgBox::MsgBox($MsgText,0,$MsgTitle)
Show-PowerShell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment