Login Register






ListProc GUI PowerShell Script [New Project] filter_list
Author
Message
ListProc GUI PowerShell Script [New Project] #1
Here's what i've got down so far, i'll be creating more advanced GUI projects like this in the future. But i'll admit, it's a pain in the ass not having a design view, you literally have to think up the layout in your head and calculate sizes and how to center each control. It's a little different.

Code:
#ListProc Powershell Script (c)AirCrypt - 2011 function CreateForm { [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null $Form1 = New-Object System.Windows.Forms.Form $btn1 = New-Object System.Windows.Forms.Button $rtb_text = New-Object System.Windows.Forms.RichTextBox $label = New-Object System.Windows.Forms.Label $btn1_click = { $rtb_text.Text = '' $Sys_Info = ps | ForEach-Object { $Proc_Info = $_.Name + ' [PID:' + $_.ID + ']' Write-Textbox $Proc_Info } } $Form1_Load = { $rtb_text.Select() } $Form1.Name = 'Form1' $Form1.Text = 'ListProc PowerShell Script' $Border_Style = New-Object System.Windows.Forms.FormBorderStyle $Border_Style = 'FixedSingle' $Form1.FormBorderStyle = $Border_Style $Form1.MaximizeBox = $False $Form1.DataBindings.DefaultDataSourceUpdateMode = 0 $Form1.BackColor = [System.Drawing.Color]::FromArgb(255,227,227,227) $Draw_Size = New-Object System.Drawing.Size $Draw_Size.Width = 350 $Draw_Size.Height = 575 $Form1.ClientSize = $Draw_Size $Form1.add_Load($Form1_Load) $rtb_text.Text = '' $rtb_text.TabIndex = 2 $rtb_text.Name = 'rtb_text' $rtb_text.ReadOnly = $True $rtb_text.Font = New-Object System.Drawing.Font("Courier New",10,0,3,0) $rtb_text.DataBindings.DefaultDataSourceUpdateMode = 0 $Draw_Size = New-Object System.Drawing.Size $Draw_Size.Width = 330 $Draw_Size.Height = 500 $rtb_text.Size = $Draw_Size $Draw_Point = New-Object System.Drawing.Point $Draw_Point.X = 10 $Draw_Point.Y = 10 $rtb_text.Location = $Draw_Point $Form1.Controls.Add($rtb_text) $btn1.UseVisualStyleBackColor = $True $btn1.TabIndex = 0 $btn1.Name = 'btn1' $btn1.Text = 'Retrieve Data' $Draw_Size = New-Object System.Drawing.Size $Draw_Size.Width = 125 $Draw_Size.Height = 21 $btn1.Size = $Draw_Size $Draw_Point = New-Object System.Drawing.Point $Draw_Point.X = 110 $Draw_Point.Y = 525 $btn1.Location = $Draw_Point $btn1.add_Click($btn1_click) $Form1.Controls.Add($btn1) $label.DataBindings.DefaultDataSourceUpdateMode = 0 $label.Name = 'label' $label.Text = 'Scripted by AirCrypt' $Draw_Size = New-Object System.Drawing.Size $Draw_Size.Width = 125 $Draw_Size.Height = 21 $label.Size = $Draw_Size $Draw_Point = New-Object System.Drawing.Point $Draw_Point.X = 122 $Draw_Point.Y = 550 $label.Location = $Draw_Point $Form1.Controls.Add($label) $Form1.ShowDialog() | Out-Null } function Write-TextBox { param([string]$text) $rtb_text.Text += "$text`n" } CreateForm

Demonstration:
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: ListProc GUI PowerShell Script [New Project] #2
No powershell coders here? lol
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: ListProc GUI PowerShell Script [New Project] #3
You Should Create a Tutorial and Maybe People Will Start to Show Interest or Curiosity. Wink

Reply

RE: ListProc GUI PowerShell Script [New Project] #4
What kind of tutorial are you looking for?
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: ListProc GUI PowerShell Script [New Project] #5
Agreed! btw thats cool Tongue

also is powershell, Powershell.NET ?
Pierce the life fibers with your drill.

Reply

RE: ListProc GUI PowerShell Script [New Project] #6
(12-03-2011, 03:40 PM)Infinity Wrote: What kind of tutorial are you looking for?

Like Basics on Powershell Scripting, How to Get Started. Stuff like that.

Reply

RE: ListProc GUI PowerShell Script [New Project] #7
Nope, Powershell is in no way related to the .Net programming group. Smile

I'll post some tutorials up if you guys really want them, i'll create them all personal.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: ListProc GUI PowerShell Script [New Project] #8
Sure post some!

btw can powershell code be compiled into a dynamic link library?
Pierce the life fibers with your drill.

Reply

RE: ListProc GUI PowerShell Script [New Project] #9
(12-03-2011, 03:45 PM)[ntdll.dll]x[advapi32.dll] Wrote: Sure post some!

btw can powershell code be compiled into a dynamic link library?

Not that I know of, I don't think it's possible.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply