KiXforms.Net Learning Series - Windows Registry Run [Project 01 - Lesson 02]

Project 01 - Lesson 02 is a continuation of:
Project 01 - Lesson 01

Guidelines:
  • All scripters are welcome, Beginners to Masters.
  • KiXforms.Net version 3.1.45.0 or newer must be used. To verify your version of KiXforms.Net, use KiXforms.Net Version Checker (found below).
  • Please do not use this series just to bump your post count.
  • Do not post solutions until after solution post time is announced.
  • Collaboration is not allowed until after solution post time is announced.
  • I will post to indicate when solution post time starts.
  • Comments are a must, be descriptive but not excessive.
  • Use descriptive variable names to make it easier for yourself and others to follow what is happening.
  • The only help allowed is:
    • 'KiXforms.chm'
    • 'Kixforms.System.tlb'
    • 'Scripted Resource (Base64) Development Kit'
    • 'KiXforms Designer .NET 2.0 (Beta)'
    • 'The Script Center Script Repository'
    • 'KiXtart.org UDF library collection'
  • Note: 'KiXforms.chm' can be found in KiXforms.Zip (KF.NET Development Build)
    'Kixforms.System.tlb' can be found in your System32 directory after the installation of KiXforms.msi (found in 'KiXfomrs.zip').
    To view 'Kixforms.System.tlb' use iTripoli Type Library Viewer.
    If you choose, you can create a shortcut to the 'iTripoli Type Library Viewer' then, modify the shortcut target to:
    "C:\Program Files\iTripoli\Tools\TypeViewer.exe" Kixforms.System.tlb,
    then the shortcut will automatically open 'Kixforms.System.tlb'.
    Get Scripted Resource (Base64) Development Kit if you want or need it.
    Get KiXforms Designer .NET 2.0 (Beta) if you want or need it.
    Go to The Script Center Script Repository if you want or need to.
    Go to KiXtart.org UDF library collection if you want or need to.
    You can also modify UDFs found in 'KiXtart.org UDF library collection' if needed but make sure you comment on your changes.
  • All submitted code should be as though it were to be used in production.
    • Code should set options to On.
    • Error checking should be in place where needed.
    • All variables including form and controls should be Dimmed.
    • All UDFs should be self contained and all variables Dimmed.
  • All code should be in code tags.
  • When creating KiXforms the command console is not desired so use 'WKiX32.exe' not 'KiX32.exe'.

KiXforms.Net Version Checker:
Code:
;KiXforms.Net Version Checker

;Set Break to On if not in Logon Mode.
If Not @LogonMode
  Break On
EndIf

;Set Code Options to On
Dim $SO
$SO=SetOption("NoMacrosInStrings", "ON")
$SO=SetOption("NoVarsInStrings", "ON")
$SO=SetOption("Explicit", "ON")

;Setup Variables.
Dim $System,$nul,$MainForm,$ProductVersionLabel,$ProductNameLabel

;Create 'Kixforms.System' Object.
$System = CreateObject("Kixforms.System")

;Verify the 'Kixforms.System' Object was created if not, notify and exit.
If Not $System
  $nul= MessageBox("KiXforms.Net Not Initiated."+@CRLF+
  "Please verify KiXforms.Net is installed."+@CRLF+
  "This Script Will Now Close.","Error",16)
  Quit()
EndIf

;Create Form and Controls.
$MainForm = $System.Form()
$MainForm.StartPosition = $System.FormStartPosition_CenterScreen
$MainForm.Size = $System.Size(338,83)
$MainForm.Text = "KiXforms.Net Version Checker"

$ProductVersionLabel = $System.Label()
$ProductVersionLabel.Dock = $System.DockStyle_Top
$ProductVersionLabel.Text = "Ver. "+$System.ProductVersion
$ProductVersionLabel.TextAlign = $System.ContentAlignment_MiddleCenter
$nul = $MainForm.Controls.Add($ProductVersionLabel)

$ProductNameLabel = $System.Label()
$ProductNameLabel.Dock = $System.DockStyle_Top
$ProductNameLabel.Text = $System.ProductName
$ProductNameLabel.TextAlign = $System.ContentAlignment_MiddleCenter
$nul = $MainForm.Controls.Add($ProductNameLabel)

;Show the Form
$MainForm.Show

;Loop to catch form events.
While $MainForm.Visible
  $nul = Execute($MainForm.DoEvents())
Loop
Exit 0


Objectives for Lesson 02:
  • Populate the 'ComboBox' with these two values.
    • "HKey_Local_Machine\Software\Microsoft\Windows\CurrentVersion\Run"
    • "HKey_Current_User\Software\Microsoft\Windows\CurrentVersion\Run"
  • Populate the top 'ListView' with the entries and values of the selected 'ComboBox.Text' registry key.
  • When the user selects a different registry key in the 'ComboBox' the top and bottom 'ListView.Items' should be cleared.
  • The top 'ListView' should have checkboxes enabled.
  • Allow the user to:
    • Backup - copy the entries and values of the selected 'ComboBox.Text' registry key to these keys respectively:
      • "HKey_Local_Machine\Software\Microsoft\Windows\CurrentVersion\RunBackup"
      • "HKey_Current_User\Software\Microsoft\Windows\CurrentVersion\RunBackup"
    • Restore - copy the entries and values of the selected 'ComboBox.Text' backup registry key to these keys respectively:
      • "HKey_Local_Machine\Software\Microsoft\Windows\CurrentVersion\Run"
      • "HKey_Current_User\Software\Microsoft\Windows\CurrentVersion\Run"
    • Restore - clear the bottom 'ListView.Items' and re-enumerate the entries and values of the selected 'ComboBox.Text' registry key.
    • Refresh - clear the top 'ListView.Items', clear the bottom 'ListView.Items' and re-enumerate the entries and values of the selected 'ComboBox.Text' registry key.
    • Exit - exit the form.

Create:
  • A function to populate the 'ComboBox'.
  • A function to populate the top 'ListView' with the entries and values of the selected 'ComboBox.Text' registry key.
  • A function for the 'Backup Button.Click' event.
  • A function for the 'Restore Button.Click' event.
  • A function for the 'Refresh Button.Click' event.
  • A function for the 'Exit Button.Click' event.

You may ask questions, but do not post code.
I will post when solutions may be posted.
You may begin..
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)