![]() |
I AM THE FUNNY!!! |
---|
Ok, I know this isn't really a GUI, but we are touching on loading forms, so it is going here goddammit!!!
...
Ok... now we have clarified that...
... let's look at some message boxes. If you are going to include message boxes in your script, you need to load/import the required info.
So at the top of your script you will need to include:
<# Shows the below output in the PowerShell window: GAC Version Location --- ------- -------- True v4.0.30319 C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll #> [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") # Supresses output [void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
Ok, so lets take a look at the dirrent typs of messages you can have:
OK | 0 |
OKCancel | 1 |
AbortRetryIgnore | 2 |
YesNoCancel | 3 |
YesNo | 4 |
RetryCancel | 5 |
None | 0 |
Hand | 16 |
Error | 16 |
Stop | 16 |
Question | 32 |
Exclamation | 48 |
Warning | 48 |
Asterisk | 64 |
Information | 64 |
# Deafult messagebox [System.Windows.Forms.MessageBox]::Show("Default" , "I am title") # Two different ways of formatting the message box [System.Windows.Forms.MessageBox]::Show("Message", "I am title", 0, 0) [System.Windows.Forms.MessageBox]::Show("Message", "I am title", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::None)
So as you can see, in the last two lines you can replace the Zero's with the corresponding number or the word with the corresponding word.
The format is (message, title, buttons, icon).
And that is enough for today. Have fun!