Hi,
I'm generating a Windows for in Powershell with the following code:
#Load Assemblies[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null
#Map
#Draw form
$Form = New-Object System.Windows.Forms.Form
$objIcon = New-Object system.drawing.icon ("logo.ico")
$form.Icon = $objIcon
$Form.width = 1000
$Form.height =500
#$Form.backcolor = [System.Drawing.Color]::CornflowerBlue
$Form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::Fixed3D
$Form.Text = "Gs-Fresh"
$Form.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",10,[System.Drawing.FontStyle]::Bold)
$Form.maximumsize = New-Object System.Drawing.Size(1000,500)
$Form.startposition = "centerscreen"
$Form.KeyPreview = $True
$Form.Add_KeyDown({if ($_.KeyCode -eq "Enter") {}})
$Form.Add_KeyDown({if ($_.KeyCode -eq "Escape")
{$Form.Close()}})
I'm trying to harvest the users input so I'd like to lock the window of the form for 10 seconds and ideally bring it back to focus after another 10 seconds.
Is this possible?