Hello,
I´m working on a installtion script which should install a .msi package and while the installation is running the user should see a message box (form) "installation running".
My problem is to get the message box (form). If I use "$Form.ShowDialog()" the script will stop as long as the form is open. And if I use "$form.Show()" I cann´t see the label text because the label is transparent.
Here is my script:
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Installation"
$Form.AutoSize = $True
$Form.AutoSizeMode = "GrowAndShrink"
$Font = New-Object System.Drawing.Font("Times New Roman",18 [System.Drawing.FontStyle]::Italic)
$Form.Font = $Font
$form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedSingle
$handler_form_Load = { $form.Location = New-Object System.Drawing.Point(600, 200) }
$form.add_Load($handler_form_Load)
$Label = New-Object System.Windows.Forms.Label
$Label.Text = "Installation running...."
$Label.AutoSize = $True
$Form.Controls.Add($Label)
# $Form.ShowDialog() | out-null
$form.Show() | out-null
#give the form focus
$form.Focus() | out-null
# Here the installation should start
$form.Close()
Regards, Martin Fischer