Advertisement
metalx1000

Very Basic Web-browser view in Power Shell GUI

Jun 13th, 2014
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2. Basic Web Browser in PowerShell
  3. you need to start power shell like this:
  4. PowerShell -ExecutionPolicy Bypass -STA
  5. #>
  6.  
  7. $URL = "http://www.filmsbykris.com"
  8.  
  9. [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
  10. [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
  11.  
  12. $Form = New-Object System.Windows.Forms.Form
  13. $Form.FormBorderStyle = "None"
  14. $Form.Text = "www.FilmsByKris.com"
  15. $Form.Size = New-Object System.Drawing.Size(800,600)
  16. $Form.StartPosition = "CenterScreen"
  17.  
  18. #$Form.AutoSize = $True
  19. #$Form.AutoSizeMode = "GrowAndShrink"
  20.  
  21.  
  22. # Main Browser
  23. $webBrowser = New-Object System.Windows.Forms.WebBrowser
  24. $webBrowser.IsWebBrowserContextMenuEnabled = $true
  25. $webBrowser.ScrollBarsEnabled = $false
  26. $webBrowser.URL = $URL
  27. $webBrowser.Width = 800
  28. $webBrowser.Height = 600
  29. $webBrowser.Location = "0, 0"
  30. $webBrowser.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor
  31.     [System.Windows.Forms.AnchorStyles]::Right -bor
  32.     [System.Windows.Forms.AnchorStyles]::Top -bor
  33.     [System.Windows.Forms.AnchorStyles]::Left
  34. $Form.Controls.Add($webBrowser)
  35.  
  36. # Display Form
  37. [void] $Form.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement