home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD52564272000.psc / frmMain.frm (.txt) next >
Encoding:
Visual Basic Form  |  2000-04-26  |  64.6 KB  |  1,632 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form frmMain 
  5.    Caption         =   "INI Manipulation"
  6.    ClientHeight    =   8655
  7.    ClientLeft      =   285
  8.    ClientTop       =   1800
  9.    ClientWidth     =   10965
  10.    Icon            =   "frmMain.frx":0000
  11.    KeyPreview      =   -1  'True
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MouseIcon       =   "frmMain.frx":1272
  15.    MousePointer    =   99  'Custom
  16.    ScaleHeight     =   8655
  17.    ScaleWidth      =   10965
  18.    WindowState     =   2  'Maximized
  19.    Begin MSComctlLib.ImageList ilDisabled 
  20.       Left            =   2031
  21.       Top             =   5640
  22.       _ExtentX        =   1005
  23.       _ExtentY        =   1005
  24.       BackColor       =   -2147483643
  25.       ImageWidth      =   32
  26.       ImageHeight     =   32
  27.       MaskColor       =   12632256
  28.       _Version        =   393216
  29.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  30.          NumListImages   =   21
  31.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  32.             Picture         =   "frmMain.frx":157C
  33.             Key             =   ""
  34.          EndProperty
  35.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  36.             Picture         =   "frmMain.frx":3D30
  37.             Key             =   "Value"
  38.          EndProperty
  39.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  40.             Picture         =   "frmMain.frx":460C
  41.             Key             =   ""
  42.          EndProperty
  43.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  44.             Picture         =   "frmMain.frx":4EE8
  45.             Key             =   ""
  46.          EndProperty
  47.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  48.             Picture         =   "frmMain.frx":57C4
  49.             Key             =   ""
  50.          EndProperty
  51.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  52.             Picture         =   "frmMain.frx":60A0
  53.             Key             =   ""
  54.          EndProperty
  55.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  56.             Picture         =   "frmMain.frx":6EF4
  57.             Key             =   ""
  58.          EndProperty
  59.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  60.             Picture         =   "frmMain.frx":7D48
  61.             Key             =   ""
  62.          EndProperty
  63.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  64.             Picture         =   "frmMain.frx":85DC
  65.             Key             =   ""
  66.          EndProperty
  67.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  68.             Picture         =   "frmMain.frx":8E70
  69.             Key             =   ""
  70.          EndProperty
  71.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  72.             Picture         =   "frmMain.frx":918C
  73.             Key             =   ""
  74.          EndProperty
  75.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  76.             Picture         =   "frmMain.frx":B940
  77.             Key             =   ""
  78.          EndProperty
  79.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  80.             Picture         =   "frmMain.frx":BC5C
  81.             Key             =   ""
  82.          EndProperty
  83.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  84.             Picture         =   "frmMain.frx":C538
  85.             Key             =   "Close"
  86.          EndProperty
  87.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  88.             Picture         =   "frmMain.frx":CE14
  89.             Key             =   ""
  90.          EndProperty
  91.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  92.             Picture         =   "frmMain.frx":D6F0
  93.             Key             =   "Settings"
  94.          EndProperty
  95.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  96.             Picture         =   "frmMain.frx":FEA4
  97.             Key             =   ""
  98.          EndProperty
  99.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  100.             Picture         =   "frmMain.frx":10780
  101.             Key             =   ""
  102.          EndProperty
  103.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  104.             Picture         =   "frmMain.frx":1105C
  105.             Key             =   "Exit"
  106.          EndProperty
  107.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  108.             Picture         =   "frmMain.frx":11378
  109.             Key             =   ""
  110.          EndProperty
  111.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  112.             Picture         =   "frmMain.frx":11C54
  113.             Key             =   ""
  114.          EndProperty
  115.       EndProperty
  116.    End
  117.    Begin MSComctlLib.ImageList ilSmall 
  118.       Left            =   2037
  119.       Top             =   4440
  120.       _ExtentX        =   1005
  121.       _ExtentY        =   1005
  122.       BackColor       =   -2147483643
  123.       ImageWidth      =   16
  124.       ImageHeight     =   16
  125.       MaskColor       =   12632256
  126.       _Version        =   393216
  127.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  128.          NumListImages   =   7
  129.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  130.             Picture         =   "frmMain.frx":11F70
  131.             Key             =   "Section"
  132.          EndProperty
  133.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  134.             Picture         =   "frmMain.frx":14724
  135.             Key             =   "Key"
  136.          EndProperty
  137.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  138.             Picture         =   "frmMain.frx":15578
  139.             Key             =   "Value"
  140.          EndProperty
  141.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  142.             Picture         =   "frmMain.frx":15E54
  143.             Key             =   "selKey"
  144.          EndProperty
  145.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  146.             Picture         =   "frmMain.frx":16CA8
  147.             Key             =   "selSection"
  148.          EndProperty
  149.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  150.             Picture         =   "frmMain.frx":16FC4
  151.             Key             =   "Move"
  152.          EndProperty
  153.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  154.             Picture         =   "frmMain.frx":178A0
  155.             Key             =   "Copy"
  156.          EndProperty
  157.       EndProperty
  158.    End
  159.    Begin MSComctlLib.StatusBar sbStatusBar 
  160.       Align           =   2  'Align Bottom
  161.       Height          =   255
  162.       Left            =   0
  163.       TabIndex        =   1
  164.       Top             =   8400
  165.       Width           =   10965
  166.       _ExtentX        =   19341
  167.       _ExtentY        =   450
  168.       _Version        =   393216
  169.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  170.          NumPanels       =   5
  171.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  172.             Object.Width           =   2
  173.             MinWidth        =   2
  174.          EndProperty
  175.          BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  176.             AutoSize        =   1
  177.             Object.Width           =   14977
  178.             MinWidth        =   2
  179.          EndProperty
  180.          BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  181.             Style           =   1
  182.             AutoSize        =   2
  183.             Enabled         =   0   'False
  184.             Object.Width           =   979
  185.             MinWidth        =   970
  186.             TextSave        =   "CAPS"
  187.          EndProperty
  188.          BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  189.             Style           =   2
  190.             AutoSize        =   2
  191.             Object.Width           =   873
  192.             MinWidth        =   882
  193.             TextSave        =   "NUM"
  194.          EndProperty
  195.          BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  196.             Style           =   6
  197.             Alignment       =   1
  198.             AutoSize        =   2
  199.             Object.Width           =   1931
  200.             MinWidth        =   1940
  201.             TextSave        =   "25-04-2000"
  202.          EndProperty
  203.       EndProperty
  204.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  205.          Name            =   "MS Sans Serif"
  206.          Size            =   8.25
  207.          Charset         =   0
  208.          Weight          =   400
  209.          Underline       =   0   'False
  210.          Italic          =   0   'False
  211.          Strikethrough   =   0   'False
  212.       EndProperty
  213.    End
  214.    Begin MSComctlLib.ImageList ilTollbar 
  215.       Left            =   2031
  216.       Top             =   5040
  217.       _ExtentX        =   1005
  218.       _ExtentY        =   1005
  219.       BackColor       =   -2147483643
  220.       ImageWidth      =   32
  221.       ImageHeight     =   32
  222.       MaskColor       =   12632256
  223.       _Version        =   393216
  224.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  225.          NumListImages   =   21
  226.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  227.             Picture         =   "frmMain.frx":1817C
  228.             Key             =   "Section"
  229.          EndProperty
  230.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  231.             Picture         =   "frmMain.frx":1A930
  232.             Key             =   "Value"
  233.          EndProperty
  234.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  235.             Picture         =   "frmMain.frx":1B20C
  236.             Key             =   "WINini"
  237.          EndProperty
  238.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  239.             Picture         =   "frmMain.frx":1BAE8
  240.             Key             =   "SystemIni"
  241.          EndProperty
  242.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  243.             Picture         =   "frmMain.frx":1C3C4
  244.             Key             =   "Gridlines"
  245.          EndProperty
  246.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  247.             Picture         =   "frmMain.frx":1CCA0
  248.             Key             =   "Key"
  249.          EndProperty
  250.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  251.             Picture         =   "frmMain.frx":1D57C
  252.             Key             =   "selKey"
  253.          EndProperty
  254.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  255.             Picture         =   "frmMain.frx":1DE58
  256.             Key             =   "Left"
  257.          EndProperty
  258.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  259.             Picture         =   "frmMain.frx":1E6EC
  260.             Key             =   "Right"
  261.          EndProperty
  262.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  263.             Picture         =   "frmMain.frx":1EF80
  264.             Key             =   "selSection"
  265.          EndProperty
  266.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  267.             Picture         =   "frmMain.frx":1F29C
  268.             Key             =   "Open"
  269.          EndProperty
  270.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  271.             Picture         =   "frmMain.frx":21A50
  272.             Key             =   "New"
  273.          EndProperty
  274.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  275.             Picture         =   "frmMain.frx":21D6C
  276.             Key             =   "lOpen"
  277.          EndProperty
  278.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  279.             Picture         =   "frmMain.frx":22648
  280.             Key             =   "Close"
  281.          EndProperty
  282.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  283.             Picture         =   "frmMain.frx":22F24
  284.             Key             =   "Find"
  285.          EndProperty
  286.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  287.             Picture         =   "frmMain.frx":23800
  288.             Key             =   "Settings"
  289.          EndProperty
  290.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  291.             Picture         =   "frmMain.frx":25FB4
  292.             Key             =   "Delete"
  293.          EndProperty
  294.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  295.             Picture         =   "frmMain.frx":26890
  296.             Key             =   "About"
  297.          EndProperty
  298.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  299.             Picture         =   "frmMain.frx":27464
  300.             Key             =   "Exit"
  301.          EndProperty
  302.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  303.             Picture         =   "frmMain.frx":27780
  304.             Key             =   "Refresh"
  305.          EndProperty
  306.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  307.             Picture         =   "frmMain.frx":2805C
  308.             Key             =   "Notepad"
  309.          EndProperty
  310.       EndProperty
  311.    End
  312.    Begin VB.PictureBox picSplitter 
  313.       BackColor       =   &H00808080&
  314.       BorderStyle     =   0  'None
  315.       FillColor       =   &H00808080&
  316.       Height          =   7815
  317.       Left            =   10671
  318.       ScaleHeight     =   3402.987
  319.       ScaleMode       =   0  'User
  320.       ScaleWidth      =   780
  321.       TabIndex        =   0
  322.       Top             =   600
  323.       Visible         =   0   'False
  324.       Width           =   72
  325.    End
  326.    Begin MSComDlg.CommonDialog CommonDialog1 
  327.       Left            =   2031
  328.       Top             =   6960
  329.       _ExtentX        =   847
  330.       _ExtentY        =   847
  331.       _Version        =   393216
  332.       DefaultExt      =   "ini"
  333.       DialogTitle     =   "Open INI"
  334.       Filter          =   "INI Files|*.ini|All Files|*.*"
  335.    End
  336.    Begin MSComctlLib.ListView lvListView 
  337.       Height          =   7815
  338.       Left            =   2637
  339.       TabIndex        =   2
  340.       Top             =   600
  341.       Width           =   8055
  342.       _ExtentX        =   14208
  343.       _ExtentY        =   13785
  344.       View            =   3
  345.       Arrange         =   1
  346.       LabelWrap       =   0   'False
  347.       HideSelection   =   0   'False
  348.       FullRowSelect   =   -1  'True
  349.       GridLines       =   -1  'True
  350.       HoverSelection  =   -1  'True
  351.       PictureAlignment=   3
  352.       _Version        =   393217
  353.       Icons           =   "ilTollbar"
  354.       SmallIcons      =   "ilSmall"
  355.       ColHdrIcons     =   "ilSmall"
  356.       ForeColor       =   -2147483640
  357.       BackColor       =   -2147483643
  358.       Appearance      =   0
  359.       NumItems        =   2
  360.       BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  361.          Key             =   "Key"
  362.          Text            =   "Key"
  363.          Object.Width           =   0
  364.          ImageIndex      =   2
  365.       EndProperty
  366.       BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  367.          SubItemIndex    =   1
  368.          Key             =   "Value"
  369.          Text            =   "Value"
  370.          Object.Width           =   0
  371.          ImageIndex      =   3
  372.       EndProperty
  373.       Picture         =   "frmMain.frx":28938
  374.    End
  375.    Begin MSComctlLib.TreeView tvTreeView 
  376.       Height          =   7815
  377.       Left            =   117
  378.       TabIndex        =   3
  379.       Top             =   600
  380.       Width           =   2415
  381.       _ExtentX        =   4260
  382.       _ExtentY        =   13785
  383.       _Version        =   393217
  384.       Indentation     =   0
  385.       LineStyle       =   1
  386.       Sorted          =   -1  'True
  387.       Style           =   1
  388.       HotTracking     =   -1  'True
  389.       ImageList       =   "ilSmall"
  390.       Appearance      =   0
  391.    End
  392.    Begin MSComctlLib.Toolbar tbToolbar 
  393.       Align           =   1  'Align Top
  394.       Height          =   570
  395.       Left            =   0
  396.       TabIndex        =   4
  397.       Top             =   0
  398.       Width           =   10965
  399.       _ExtentX        =   19341
  400.       _ExtentY        =   1005
  401.       ButtonWidth     =   1032
  402.       ButtonHeight    =   1005
  403.       Wrappable       =   0   'False
  404.       Style           =   1
  405.       ImageList       =   "ilTollbar"
  406.       DisabledImageList=   "ilDisabled"
  407.       HotImageList    =   "ilDisabled"
  408.       _Version        =   393216
  409.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  410.          NumButtons      =   22
  411.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  412.             Key             =   "tbStart"
  413.             Style           =   3
  414.          EndProperty
  415.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  416.             Key             =   "Left"
  417.             Object.ToolTipText     =   "Back"
  418.             ImageKey        =   "Left"
  419.          EndProperty
  420.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  421.             Key             =   "Right"
  422.             Object.ToolTipText     =   "Forward"
  423.             ImageKey        =   "Right"
  424.          EndProperty
  425.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  426.             Style           =   3
  427.          EndProperty
  428.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  429.             Key             =   "New"
  430.             Description     =   "New Ini"
  431.             Object.ToolTipText     =   "New Ini"
  432.             ImageKey        =   "New"
  433.          EndProperty
  434.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  435.             Key             =   "Open INI"
  436.             Description     =   "Open INI"
  437.             Object.ToolTipText     =   "Open INI"
  438.             ImageKey        =   "lOpen"
  439.          EndProperty
  440.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  441.             Key             =   "Close"
  442.             Description     =   "Close"
  443.             Object.ToolTipText     =   "Close"
  444.             ImageKey        =   "Close"
  445.          EndProperty
  446.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  447.             Style           =   3
  448.          EndProperty
  449.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  450.             Key             =   "Rename"
  451.             Description     =   "Rename Selected Item"
  452.             Object.ToolTipText     =   "Rename Selected Item"
  453.             ImageKey        =   "Value"
  454.          EndProperty
  455.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  456.             Key             =   "Delete"
  457.             Description     =   "Delete Item"
  458.             Object.ToolTipText     =   "Delete"
  459.             ImageKey        =   "Delete"
  460.          EndProperty
  461.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  462.             Key             =   "WordPad"
  463.             Description     =   "Open in WordPad"
  464.             Object.ToolTipText     =   "Open Ini in WordPad"
  465.             ImageKey        =   "Notepad"
  466.          EndProperty
  467.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  468.             Style           =   3
  469.          EndProperty
  470.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  471.             Key             =   "Refresh"
  472.             Description     =   "Refresh"
  473.             Object.ToolTipText     =   "Refresh"
  474.             ImageKey        =   "Refresh"
  475.          EndProperty
  476.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  477.             Style           =   3
  478.          EndProperty
  479.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  480.             Key             =   "Win.ini"
  481.             Description     =   "Open Win.ini"
  482.             Object.ToolTipText     =   "Open Win.ini"
  483.             ImageKey        =   "WINini"
  484.          EndProperty
  485.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  486.             Key             =   "System.ini"
  487.             Description     =   "Open system.ini"
  488.             Object.ToolTipText     =   "Open system.ini"
  489.             ImageKey        =   "SystemIni"
  490.          EndProperty
  491.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  492.             Style           =   3
  493.          EndProperty
  494.          BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  495.             Key             =   "View Gridlines"
  496.             Description     =   "View Gridlines"
  497.             Object.ToolTipText     =   "View Gridlines"
  498.             ImageKey        =   "Gridlines"
  499.             Style           =   1
  500.             Value           =   1
  501.          EndProperty
  502.          BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  503.             Key             =   "Find"
  504.             Description     =   "Find Item"
  505.             Object.ToolTipText     =   "Find"
  506.             ImageKey        =   "Find"
  507.          EndProperty
  508.          BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  509.             Style           =   3
  510.          EndProperty
  511.          BeginProperty Button21 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  512.             Key             =   "about"
  513.             Description     =   "about"
  514.             Object.ToolTipText     =   "About"
  515.             ImageKey        =   "About"
  516.          EndProperty
  517.          BeginProperty Button22 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  518.             Key             =   "Exit"
  519.             Description     =   "Exit"
  520.             Object.ToolTipText     =   "Exit"
  521.             ImageKey        =   "Exit"
  522.          EndProperty
  523.       EndProperty
  524.    End
  525.    Begin VB.Image imgSplitter 
  526.       Height          =   7815
  527.       Left            =   2517
  528.       MousePointer    =   9  'Size W E
  529.       Top             =   600
  530.       Width           =   120
  531.    End
  532.    Begin VB.Menu mnuFile 
  533.       Caption         =   "&File"
  534.       Begin VB.Menu mnuFileNew 
  535.          Caption         =   "&New..."
  536.          Shortcut        =   ^N
  537.       End
  538.       Begin VB.Menu mnuFileOpen 
  539.          Caption         =   "&Open..."
  540.          Shortcut        =   ^O
  541.       End
  542.       Begin VB.Menu mnuFileClose 
  543.          Caption         =   "&Close"
  544.          Shortcut        =   ^W
  545.       End
  546.       Begin VB.Menu mnublank2 
  547.          Caption         =   "-"
  548.       End
  549.       Begin VB.Menu mnuFileExit 
  550.          Caption         =   "&Exit"
  551.          Shortcut        =   ^Q
  552.       End
  553.    End
  554.    Begin VB.Menu mnuEdit 
  555.       Caption         =   "&Edit"
  556.       Begin VB.Menu mnuEditEditWordPad 
  557.          Caption         =   "&Edit in WordPad"
  558.          Shortcut        =   ^E
  559.       End
  560.       Begin VB.Menu mnuEditRename 
  561.          Caption         =   "&Rename"
  562.          Shortcut        =   {F2}
  563.       End
  564.       Begin VB.Menu mnublank10 
  565.          Caption         =   "-"
  566.       End
  567.       Begin VB.Menu mnuEditFind 
  568.          Caption         =   "&Find"
  569.          Shortcut        =   {F3}
  570.       End
  571.       Begin VB.Menu mnublank3 
  572.          Caption         =   "-"
  573.       End
  574.       Begin VB.Menu mnuEditDelete 
  575.          Caption         =   "&Delete"
  576.          Shortcut        =   {DEL}
  577.       End
  578.    End
  579.    Begin VB.Menu mnuView 
  580.       Caption         =   "&View"
  581.       Begin VB.Menu mnuViewToolbar 
  582.          Caption         =   "&Toolbar"
  583.          Checked         =   -1  'True
  584.          Shortcut        =   ^T
  585.       End
  586.       Begin VB.Menu mnuViewStatusbar 
  587.          Caption         =   "&Status Bar"
  588.          Checked         =   -1  'True
  589.          Shortcut        =   ^S
  590.       End
  591.       Begin VB.Menu mnublank5 
  592.          Caption         =   "-"
  593.       End
  594.       Begin VB.Menu mnuViewGridlines 
  595.          Caption         =   "&View GridLines"
  596.          Checked         =   -1  'True
  597.       End
  598.       Begin VB.Menu mnublank6 
  599.          Caption         =   "-"
  600.       End
  601.       Begin VB.Menu mnuViewIcons 
  602.          Caption         =   "&Icons"
  603.       End
  604.       Begin VB.Menu mnuViewSmallIcons 
  605.          Caption         =   "S&mall Icons"
  606.       End
  607.       Begin VB.Menu mnuViewList 
  608.          Caption         =   "&List"
  609.       End
  610.       Begin VB.Menu mnuViewDetails 
  611.          Caption         =   "&Details"
  612.          Checked         =   -1  'True
  613.       End
  614.       Begin VB.Menu mnublank7 
  615.          Caption         =   "-"
  616.       End
  617.       Begin VB.Menu mnuViewRefresh 
  618.          Caption         =   "&Refresh"
  619.          Shortcut        =   {F5}
  620.       End
  621.    End
  622.    Begin VB.Menu mnuAbout 
  623.       Caption         =   "&About"
  624.    End
  625.    Begin VB.Menu mnupop 
  626.       Caption         =   "&pop"
  627.       Visible         =   0   'False
  628.       Begin VB.Menu mnuCreate 
  629.          Caption         =   "&Create"
  630.          Begin VB.Menu mnuCreateSection 
  631.             Caption         =   "Create &Section"
  632.          End
  633.          Begin VB.Menu mnuCreateKeyValue 
  634.             Caption         =   "Create &Key/Value"
  635.          End
  636.       End
  637.       Begin VB.Menu mnuRename 
  638.          Caption         =   "&Rename"
  639.       End
  640.       Begin VB.Menu mnuDelete 
  641.          Caption         =   "&Delete"
  642.          Begin VB.Menu mnuDeleteSection 
  643.             Caption         =   "Delete &Section"
  644.          End
  645.          Begin VB.Menu mnuDeleteKey 
  646.             Caption         =   "Delete &Key"
  647.          End
  648.          Begin VB.Menu mnuDeleteValue 
  649.             Caption         =   "Delete &Value"
  650.          End
  651.       End
  652.       Begin VB.Menu mnublank8 
  653.          Caption         =   "-"
  654.       End
  655.       Begin VB.Menu mnuExpande 
  656.          Caption         =   "&Expande"
  657.       End
  658.       Begin VB.Menu mnuExpandeAll 
  659.          Caption         =   "Expande &All"
  660.       End
  661.       Begin VB.Menu mnublank9 
  662.          Caption         =   "-"
  663.       End
  664.       Begin VB.Menu mnuCollapse 
  665.          Caption         =   "Co&llapse"
  666.       End
  667.       Begin VB.Menu mnuCollapseAll 
  668.          Caption         =   "Colla&pse All"
  669.       End
  670.       Begin VB.Menu mnublank11 
  671.          Caption         =   "-"
  672.       End
  673.       Begin VB.Menu mnuRefresh 
  674.          Caption         =   "Re&fresh"
  675.       End
  676.    End
  677. Attribute VB_Name = "frmMain"
  678. Attribute VB_GlobalNameSpace = False
  679. Attribute VB_Creatable = False
  680. Attribute VB_PredeclaredId = True
  681. Attribute VB_Exposed = False
  682. '|'==================================================================================
  683. '|'**********************************************************************************
  684. '|'* Author: Marco Sambento
  685. '|'* Date: April/2000
  686. '|'* Notes: This project was made to help understanding, mainly the routines of
  687. '|'   manipulating INI Files, such as reading/writing, renaming and deleting sections
  688. '|'   and keys/values, but it's also a good exercise on TreeView operations and some
  689. '|'   other usefull routines.
  690. '|'   I take no responsability in the misuse of this program or for any damage
  691. '|'   caused!
  692. '|'   Be specially careful when editing 'win.ini' and 'system.ini' files!
  693. '|'FEATURES:
  694. '|'   - Dragdrop keys, option for move or copy Key, by using Ctrl Key
  695. '|'   - Context Menus
  696. '|'   - Open/Close/Create INI File
  697. '|'   - Resize, etc...
  698. '|'  Please send all feedback and report bugs/suggestions to:
  699. '|'* Email: marco.sambento@netc.pt
  700. '|' ---------  Please Keep This Text When Using/Distributing This Code  ------------
  701. '|'**********************************************************************************
  702. '|'==================================================================================
  703. Dim indrag As Boolean           ' Flag that signals a Drag Drop operation.
  704. Public nodDrag As Node          ' Item that is being dragged.
  705. Public CopyNode As Boolean      ' in a drag 'n drop operation, sets move or copy node
  706. Dim mbMoving As Boolean         ' determines if treeview/listview are being sized
  707. Public FileOpen As Boolean      ' determines if a file is open
  708. Public FileIsEmpty As Boolean   ' if file is empty
  709. Dim numSections As Integer      ' number of sections to display in statusbar
  710. Const sglSplitLimit = 2250      ' limit for resizing treeview and listview
  711. Private Sub Form_Load()
  712. If Command$ <> vbNullString Then
  713.     INIPath = Command$
  714.     If Dir(INIPath) <> vbNullString Then
  715.         FilltvTreeView
  716.     End If
  717. 'replace with new file or simply erase it
  718.    INIPath = App.Path & "\marco.ini"
  719.     If Dir(INIPath) = vbNullString Then
  720.         mnuFileOpen_Click
  721.     Else
  722.         FilltvTreeView
  723.     End If
  724. End If
  725. End Sub
  726. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  727. Dim Button As VbMsgBoxResult
  728.     Button = MsgBox("Are You Sure?", vbInformation + vbYesNo, "Exit...")
  729.     If Button = vbNo Then Cancel = True: Exit Sub
  730.     Unload Me
  731. End Sub
  732. Private Sub Form_Unload(Cancel As Integer)
  733.  Dim i As Integer
  734.     'close all sub forms
  735.     For i = Forms.Count - 1 To 1 Step -1
  736.         Unload Forms(i)
  737.     Next
  738. End Sub
  739. '**********************************************************************************
  740. '==================================================================================
  741. '            READ INI FILE AND FILL TREEVIEW    marco.sambento@netc.pt
  742. '==================================================================================
  743. Public Function FilltvTreeView()
  744. On Error Resume Next
  745.     If Not FileOpen Then Exit Function
  746.     Dim Button As Integer
  747.     Dim firstChar As String
  748.     Dim lastChar As String
  749.     Dim FileData As String
  750.     Dim Section As String
  751.     Dim posKey As Integer
  752.     Dim Key As String
  753.     Dim nodeKey As Node
  754.     Filename = INIPath
  755.     Me.Caption = App.Title & " - '" & StrConv(Filename, vbProperCase) & "'"
  756.     tvTreeView.Nodes.clear
  757.     numSections = 0
  758.     If Len(Filename) Then
  759.         Open Filename For Input As #1
  760.         Do While Not EOF(1)     ' while it isn't the end of file, get another line
  761.             Line Input #1, FileData 'line text
  762.             
  763.             firstChar = Left(FileData, 1)
  764.             lastChar = Right(FileData, 1)
  765.             
  766.             If firstChar = "[" And lastChar = "]" Then 'if it's a section
  767.                 Section = Mid(FileData, 2, Len(FileData) - 2)
  768.                 'then add section
  769.                 tvTreeView.Nodes.Add , , Section, Section, "Section", "selSection"
  770.                 numSections = numSections + 1
  771.             Else ' it's a key
  772.                 posKey = InStr(FileData, "=")
  773.                 If posKey <> 0 And Section <> vbNullString Then
  774.                 'add key to current section
  775.                     Key = Left(FileData, posKey - 1)
  776.                     tvTreeView.Nodes.Add Section, tvwChild, , Key, "Key", "selKey"
  777.                 End If
  778.             End If
  779.         Loop
  780.         Close #1
  781.     End If
  782. Call CheckFile
  783. If frmFind.FindIsLoaded Then frmFind.txtFind_KeyUp 0, 0 'update findform to new file
  784. If FileIsEmpty Then lvListView.ListItems.clear _
  785. : MsgBox "Invalid or Empty INI File!", vbCritical, "Invalid" _
  786. : Exit Function
  787.     tvTreeView.SelectedItem = tvTreeView.Nodes.Item(1)
  788.     tvTreeView.SelectedItem.Expanded = True
  789.     tvTreeView_NodeClick tvTreeView.SelectedItem    'update listview
  790. End Function
  791. '==================================================================================
  792. '  READ SECTIONS AND KEYS IN TREEVIEW AND FILL LISTVIEW     marco.sambento@netc.pt
  793. '==================================================================================
  794. Public Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
  795. If Not FileOpen Or FileIsEmpty Then Exit Sub
  796.     Dim Value As String
  797.     Dim numKey As Integer
  798.     Dim Childrens As Integer
  799.     Dim first As Integer
  800.     Dim last As Integer
  801.     Dim Item As ListItem
  802.     lvListView.ListItems.clear      'clear listview
  803.     If Node.Parent Is Nothing Then 'if node is a section
  804.     mnuViewDetails.Enabled = True 'enable menu 'Details'
  805.     mnuViewDetails_Click          'set listview mode as details
  806.         
  807.         If Node.Children > 0 Then    'if it has at least a key
  808.         numKey = Node.Child.FirstSibling.Index    'first key index
  809.         
  810.         Do
  811.              Set Item = lvListView.ListItems.Add(, , _
  812.              tvTreeView.Nodes.Item(numKey).Text, "Key", "Key")
  813.              'add the key to listview
  814.              With Item
  815.                 Section = Node.Text
  816.                 Key = Item.Text
  817.                 Value = GetVal(Section, Key)    'get value for current key
  818.                 .SubItems(1) = Value    'add the value to second column on listview
  819.                 .Tag = numKey     'holds the node index because the key can't be a number
  820.              End With
  821.             If numKey <> Node.Child.LastSibling.Index Then _
  822.             numKey = tvTreeView.Nodes(numKey).Next.Index Else Exit Do
  823.         Loop
  824.         End If
  825.     Else    'if selected node is a key in tree
  826.         mnuViewDetails.Enabled = False 'disable menu 'Details'
  827.         mnuViewList_Click
  828.         Section = Node.Parent.Text
  829.         Key = Node.Text
  830.         Value = GetVal(Section, Key)
  831.         lvListView.ListItems.Add , , Value, "Value", "Value"
  832.     End If
  833. 'checks if there are items and enable/disable menus
  834.     If lvListView.SelectedItem Is Nothing Then
  835.         mnuDeleteValue.Enabled = False
  836.         mnuDeleteKey.Enabled = False
  837.     Else
  838.         mnuDeleteValue.Enabled = True
  839.         mnuDeleteKey.Enabled = True
  840.     End If
  841. UpdateStatusBar
  842. End Sub
  843. '**********************************************************************************
  844. '==================================================================================
  845. '          CREATE      SECTIONS/KEYS/VALUES          marco.sambento@netc.pt
  846. '==================================================================================
  847. Private Sub mnuCreateSection_Click()
  848.    Dim i As Integer
  849.    Dim newSection As String
  850.    Dim newSectionNode As Node
  851.    Dim newKeyNode As Node
  852.         If FileIsEmpty Then  'if it's 1st section create "New Section"
  853.                 Create "New Section", "New Key", "New Value"
  854.                 'add section to tree, and new key/value
  855.                 Set newSectionNode = tvTreeView.Nodes.Add(, , "New Section", "New Section", "Section", "selSection")
  856.                 tvTreeView.Nodes.Add "New Section", tvwChild, , "New Key", "Key", "selKey"
  857.                 Call CheckFile
  858.         Else    ' check if new section already exists, if so increase section number
  859. ReStartCheck:
  860.             numSection = tvTreeView.SelectedItem.Root.FirstSibling.Index
  861.         Do    'check if matches section
  862.             If tvTreeView.Nodes.Item(numSection).Text = "New Section" & i _
  863.             Then i = i + 1: GoTo ReStartCheck ' if so increases and restart
  864.             'if not check next section
  865.             If numSection <> tvTreeView.SelectedItem.Root.LastSibling.Index _
  866.             Then numSection = tvTreeView.Nodes.Item(numSection).Next.Index Else Exit Do
  867.         Loop
  868.                 'create section
  869.             newSection = "New Section" & i
  870.             Create newSection, "New Key", "New Value"
  871.                 ' and add it to tree
  872.             Set newSectionNode = tvTreeView.Nodes.Add(, , newSection, newSection, "Section", "selSection")
  873.             tvTreeView.Nodes.Add newSection, tvwChild, , "New Key", "Key", "selKey"
  874.             
  875.         End If
  876.     numSections = numSections + 1
  877.     tvTreeView.SelectedItem = newSectionNode
  878.     tvTreeView_NodeClick newSectionNode
  879.     newSectionNode.Expanded = True
  880.     tvTreeView.StartLabelEdit
  881. End Sub
  882. Private Sub mnuCreateKeyValue_Click()
  883. ' does the same as create section, but for keys
  884.    Dim i As Integer
  885.    Dim newKey As Node
  886.    Dim Section As Node
  887.    If FileIsEmpty Then mnuCreateSection_Click: Exit Sub
  888.     If tvTreeView.SelectedItem.Parent Is Nothing Then
  889.         Set Section = tvTreeView.SelectedItem
  890.     Else
  891.         Set Section = tvTreeView.SelectedItem.Parent
  892.     End If
  893.       If Section.Children = 0 Then '1st key
  894.            Create Section, "New Key", "New Value"
  895.            tvTreeView.Nodes.Add Section, tvwChild, , "New Key", "Key", "selKey"
  896.       Else   'check if key exists
  897. Repeat:    numKey = Section.Child.FirstSibling.Index
  898.          Do
  899.             
  900.          If tvTreeView.Nodes.Item(numKey) = "New Key" & i Then i = i + 1: GoTo Repeat
  901.             
  902.          If numKey <> Section.Child.LastSibling.Index Then _
  903.            numKey = tvTreeView.Nodes.Item(numKey).Next.Index Else Exit Do
  904.          Loop
  905.            
  906.          Create Section, "New Key" & i, "New Value"
  907.          Set newKey = tvTreeView.Nodes.Add(Section, tvwChild, , "New Key" & i, "Key", "selKey")
  908.        End If
  909.    tvTreeView.SelectedItem = newKey
  910.    tvTreeView.StartLabelEdit
  911. End Sub
  912. '==================================================================================
  913. '             DELETE     SECTIONS/KEYS/VALUES         marco.sambento@netc.pt
  914. '==================================================================================
  915. Public Sub mnuDeleteSection_Click()
  916. Dim Button As VbMsgBoxResult
  917.     If tvTreeView.SelectedItem.Parent Is Nothing Then 'menu was poped up in a section
  918.         Section = tvTreeView.SelectedItem
  919.     Else    'menu was poped up in a key
  920.         Section = tvTreeView.SelectedItem.Parent
  921.     End If
  922.         
  923.         Button = MsgBox("Delete Section '" & Section & "'?", _
  924.         vbOKCancel + vbExclamation, "Delete Section...")
  925.         
  926.         If Button = vbCancel Then Exit Sub
  927.         DeleteSection Section               'delete section in file
  928.         tvTreeView.Nodes.Remove Section     'delete section in treee
  929.         numSections = numSections - 1   'decrease numsections
  930.         
  931.         If numSections = 0 Then lvListView.ListItems.clear: Call CheckFile: Exit Sub
  932.         tvTreeView_NodeClick tvTreeView.SelectedItem
  933. End Sub
  934. Public Sub mnuDeleteKey_Click()
  935. Dim Button As VbMsgBoxResult
  936.     If tvTreeView.SelectedItem.Parent Is Nothing Then 'menu poped up in section
  937.         Section = tvTreeView.SelectedItem
  938.         Key = lvListView.SelectedItem
  939.         KeyNode = lvListView.SelectedItem.Tag 'if you remember keys in listview
  940.             'hold the key index from tree (see tvtreeview_nodeclick event)
  941.     Else 'menu poped up in key
  942.         Section = tvTreeView.SelectedItem.Parent
  943.         Key = tvTreeView.SelectedItem
  944.         KeyNode = tvTreeView.SelectedItem.Index
  945.     End If
  946.         
  947.         Button = MsgBox("Delete Key '" & Key & "'?", vbOKCancel + vbExclamation, "Delete Key...")
  948.         If Button = vbCancel Then Exit Sub
  949.         
  950.         DeleteKey Section, Key 'delete key in file
  951.         tvTreeView.Nodes.Remove (KeyNode) 'delete key in section
  952.     tvTreeView_NodeClick tvTreeView.SelectedItem
  953. End Sub
  954. Public Sub mnuDeleteValue_Click()
  955. 'the same as above, except for subitem
  956. Dim Button As VbMsgBoxResult
  957.     If lvListView.SelectedItem.Tag = vbNullString Then 'only keys in listview have tag
  958.         Section = tvTreeView.SelectedItem.Parent       'see tvtree_nodeclick, key add part
  959.         Key = tvTreeView.SelectedItem
  960.         Value = lvListView.SelectedItem
  961.     Else 'in listview it's only a value and not keys and subitems
  962.         Section = tvTreeView.SelectedItem
  963.         Key = lvListView.SelectedItem
  964.         Value = lvListView.SelectedItem.SubItems(1)
  965.         subItem = True 'to know wich value to delete: a subitem
  966.     End If
  967.         Button = MsgBox("Delete value '" & Value & "'?", vbOKCancel + vbExclamation, "Delete value...")
  968.         If Button = vbCancel Then Exit Sub
  969.         
  970.         DeleteValue Section, Key ' delete in file
  971.         'delete in listview, if subitem is true then delete the subitem, else delete value
  972.         If subItem Then lvListView.SelectedItem.SubItems(1) = vbNullString _
  973.         Else lvListView.SelectedItem.Text = vbNullString: _
  974.         tvTreeView_NodeClick tvTreeView.SelectedItem.Parent
  975. End Sub
  976. '**********************************************************************************
  977. '==================================================================================
  978. '                 RENAME    SECTIONS/KEYS        marco.sambento@netc.pt
  979. '==================================================================================
  980. Private Sub tvTreeView_AfterLabelEdit(Cancel As Integer, NewString As String)
  981.     On Error GoTo error
  982.     Dim nullCharPos As Integer
  983.     Dim StringStart As Integer
  984.     Dim Section As String
  985.     Dim SectionStrings As String
  986.     Dim KeyValueStr As String
  987.     Dim Key As String
  988.     Dim Value As String
  989.     Dim Button As VbMsgBoxResult
  990.     If tvTreeView.SelectedItem.Parent Is Nothing Then 'if is a section, rename it
  991.         numSection = tvTreeView.SelectedItem.FirstSibling.Index    'first section index
  992.     Do 'check if already exists section and prompt if so
  993.         If LCase(tvTreeView.Nodes.Item(numSection).Text) = LCase(NewString) Then
  994.             MsgBox "Section '" & NewString & "' already exists!", vbExclamation, "Rename Section..."
  995.             Cancel = True
  996.             tvTreeView.StartLabelEdit
  997.             SendKeys NewString & "{home}+({end})"
  998.             Exit Sub
  999.         End If
  1000.         'if not the last section, get next
  1001.         If numSection <> tvTreeView.SelectedItem.LastSibling.Index Then _
  1002.         numSection = tvTreeView.Nodes.Item(numSection).Next.Index Else Exit Do
  1003.         
  1004.     Loop ' next key
  1005.         Button = MsgBox("Change section '" & tvTreeView.SelectedItem.Text & _
  1006.         "' with '" & NewString & "'?", vbExclamation + vbOKCancel, "Rename Section...")
  1007.         
  1008.         If Button = vbCancel Then Cancel = True: Exit Sub
  1009.         
  1010.         tvTreeView.SelectedItem.Key = NewString ' change key to newstring(sections hve keys with their names, see filltvtreeview)
  1011.         Section = tvTreeView.SelectedItem
  1012.         SectionStrings = GetSection(Section) 'retrieves keys and values from section
  1013.         Size = Len(SectionStrings)
  1014.         
  1015.         DeleteSection Section
  1016. StringStart = 1
  1017. NextString:
  1018.             nullCharPos = InStr(StringStart, SectionStrings, vbNullChar)
  1019.             'find 1st 'key=value' string and extract them
  1020.             KeyValueStr = Mid(SectionStrings, StringStart, nullCharPos - 1)
  1021.             Key = Left(KeyValueStr, InStr(KeyValueStr, "=") - 1)
  1022.             Value = Right(KeyValueStr, Len(KeyValueStr) - InStr(KeyValueStr, "="))
  1023.             'create new key
  1024.             Create NewString, Key, Value
  1025.             'adds key and value to file
  1026.             StringStart = nullCharPos + 1 ' new 'key=value' string start
  1027.             
  1028.             If nullCharPos <> Size Then GoTo NextString ' if it's not the end of
  1029.                                                 'strings then get another string
  1030.     Else    'its a key, so rename it
  1031.             Section = tvTreeView.SelectedItem.Parent
  1032.             Key = tvTreeView.SelectedItem
  1033.             Value = GetVal(Section, Key)
  1034.         
  1035.         If tvTreeView.SelectedItem.Parent.Children > 1 Then ' if exists more than a key in section
  1036.             numKey = tvTreeView.SelectedItem.FirstSibling.Index
  1037.             
  1038.             Do    'for each key check if already exists
  1039.             If LCase(tvTreeView.Nodes.Item(numKey).Text) = LCase(NewString) Then
  1040.                     MsgBox "Key '" & NewString & "' already exists!", vbExclamation, "Rename Key..."
  1041.                     Cancel = True
  1042.                     tvTreeView.StartLabelEdit
  1043.                     SendKeys NewString & "{home}+({end})"
  1044.                     Exit Sub
  1045.             End If
  1046.                 If numKey <> tvTreeView.SelectedItem.LastSibling.Index Then _
  1047.                 numKey = tvTreeView.Nodes.Item(numKey).Next.Index Else Exit Do
  1048.             Loop
  1049.         End If
  1050.             Button = MsgBox("Change Key '" & Key & _
  1051.             "' with '" & NewString & "'?", vbExclamation + vbOKCancel, "Rename Key...")
  1052.             If Button = vbCancel Then Cancel = True: Exit Sub
  1053.             Create Section, NewString, Value
  1054.             DeleteKey Section, Key
  1055.     End If
  1056. Exit Sub
  1057. error:
  1058. If Err = 35603 Then MsgBox "Please choose a name with at least a letter!", _
  1059. vbCritical, "Invalid Section...": Cancel = True:: tvTreeView.StartLabelEdit: _
  1060. SendKeys NewString & "{home}+({end})": Exit Sub
  1061. 'the key property doesn't suport numbers
  1062. 'but it's unlikely to use only numbers to define a section
  1063. 'however that is easily correct, by for example adding "S" to the key,
  1064. 'it make the code confuse.
  1065. MsgBox "Error '" & Err & " - " & Err.Description & "' occured.", vbCritical, "Error"
  1066. End Sub
  1067. '==================================================================================
  1068. '          RENAME/CHANGE        KEYS/VALUES        marco.sambento@netc.pt
  1069. '==================================================================================
  1070. Private Sub lvlistView_AfterLabelEdit(Cancel As Integer, NewString As String)
  1071. Dim Section As String
  1072. Dim Key As String
  1073. Dim Value As String
  1074. Dim Button As VbMsgBoxResult
  1075.     ' just has above, but now to rename keys/values
  1076.     If lvListView.SelectedItem.Tag <> vbNullString Then 'only keys have tag, see nodeclick
  1077.         Value = lvListView.SelectedItem.SubItems(1)
  1078.         Key = lvListView.SelectedItem
  1079.         Section = tvTreeView.SelectedItem
  1080.         For numKey = 1 To lvListView.ListItems.Count
  1081.             If LCase(lvListView.ListItems.Item(numKey).Text) = LCase(NewString) Then
  1082.                 MsgBox "Key '" & NewString & "' already exists!", vbExclamation, "Rename Key..."
  1083.                 Cancel = True
  1084.                 lvListView.StartLabelEdit
  1085.                 SendKeys NewString & "{home}+({end})"
  1086.                 Exit Sub
  1087.             End If
  1088.         Next numKey
  1089.         Button = MsgBox("Change Key '" & Key & _
  1090.         "' with '" & NewString & "'?", vbExclamation + vbOKCancel, "Rename Key...")
  1091.         
  1092.         If Button = vbCancel Then Cancel = True: Exit Sub
  1093.         
  1094.         Create Section, NewString, Value
  1095.         DeleteKey Section, Key
  1096.         tvTreeView.Nodes.Item(lvListView.SelectedItem.Tag).Text = NewString
  1097.     Else 'it's a value
  1098.         Section = tvTreeView.SelectedItem.Parent
  1099.         Key = tvTreeView.SelectedItem.Text
  1100.         Value = lvListView.SelectedItem.Text
  1101.         
  1102.         Button = MsgBox("Change value '" & Value & _
  1103.         "' with '" & NewString & "'?", vbExclamation + vbOKCancel, "Change Value...")
  1104.         
  1105.         If Button = vbCancel Then Cancel = True: Exit Sub
  1106.         
  1107.         Value = NewString
  1108.         Create Section, Key, Value
  1109.     End If
  1110. End Sub
  1111. '**********************************************************************************
  1112. Private Sub tbtoolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  1113.     Select Case Button.Key
  1114.         Case "WordPad"
  1115.         mnuEditEditWordPad_Click
  1116.         
  1117.         Case "Close"
  1118.         mnuFileClose_Click
  1119.         
  1120.         Case "New"
  1121.         mnuFileNew_Click
  1122.         
  1123.         Case "Exit"
  1124.         mnuFileExit_Click
  1125.         
  1126.         Case "Win.ini"
  1127.         
  1128.         INIPath = WinDir & "\win.ini"
  1129.         EnableDisable
  1130.         FilltvTreeView
  1131.         
  1132.         Case "System.ini"
  1133.         INIPath = WinDir & "\system.ini"
  1134.         EnableDisable
  1135.         FilltvTreeView
  1136.         Case "View Gridlines"
  1137.         mnuViewGridlines_Click
  1138.             
  1139.         Case "Find"
  1140.         mnuEditFind_Click
  1141.         
  1142.         Case "Open INI"
  1143.         mnuFileOpen_Click
  1144.         
  1145.         Case "Left"
  1146.         tvTreeView.SetFocus
  1147.         SendKeys "{up}"
  1148.                         
  1149.         Case "Right"
  1150.         tvTreeView.SetFocus
  1151.         If tvTreeView.SelectedItem.Parent Is Nothing Then
  1152.             If tvTreeView.SelectedItem.Children = 0 Then SendKeys "{down}"
  1153.             SendKeys "{right}"
  1154.         Else
  1155.             SendKeys "{down}"
  1156.         End If
  1157.         
  1158.         Case "Delete"
  1159.         mnuEditDelete_Click
  1160.         
  1161.         Case "Refresh"
  1162.         mnuViewRefresh_Click
  1163.         
  1164.         Case "Rename"
  1165.         mnuEditRename_Click
  1166.                 
  1167.         Case "about"
  1168.         mnuAbout_Click
  1169.         
  1170.     End Select
  1171. End Sub
  1172. Public Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  1173. If Not FileOpen Or FileIsEmpty Then Exit Sub
  1174.     If indrag Then If Shift = 2 Then CopyNode = True: _
  1175.     tvTreeView.DragIcon = ilSmall.ListImages.Item("Copy").Picture
  1176. End Sub
  1177. Public Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
  1178. If Not FileOpen Or FileIsEmpty Then Exit Sub
  1179.     Select Case KeyCode
  1180.         Case Is = 93
  1181.             PopupMenu mnupop
  1182.         Case vbKeyF1
  1183.             mnuAbout_Click
  1184.     End Select
  1185.         CopyNode = False
  1186.         tvTreeView.DragIcon = ilSmall.ListImages.Item("Move").Picture
  1187. End Sub
  1188. Private Sub lvListView_KeyUp(KeyCode As Integer, Shift As Integer)
  1189. If Not FileOpen Or FileIsEmpty Then Exit Sub
  1190.         
  1191.     Select Case KeyCode
  1192.         Case vbKeyBack
  1193.             If Not (tvTreeView.SelectedItem.Parent Is Nothing) Then
  1194.                 tvTreeView.SelectedItem = tvTreeView.SelectedItem.Parent
  1195.                 tvTreeView_NodeClick tvTreeView.SelectedItem
  1196.             End If
  1197.         Case vbKeyReturn
  1198.             lvlistView_DblClick
  1199.     End Select
  1200. End Sub
  1201. Private Sub tvTreeView_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  1202. If Not FileOpen Then Exit Sub
  1203.     If Button = vbRightButton Then
  1204.         If FileIsEmpty Then
  1205.             PopupMenu mnuCreate
  1206.             Exit Sub
  1207.         Else
  1208.             If Not (tvTreeView.SelectedItem Is Nothing) Then _
  1209.             mnuRename.Enabled = True: PopupMenu mnupop
  1210.         End If
  1211.     End If
  1212. End Sub
  1213. Private Sub lvlistView_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  1214. If Not FileOpen Then Exit Sub
  1215.     If Button = vbRightButton Then
  1216.         If FileIsEmpty Then
  1217.             PopupMenu mnuCreate
  1218.         Else
  1219.             If lvListView.SelectedItem Is Nothing Then _
  1220.             mnuDeleteValue.Enabled = False: mnuDeleteKey.Enabled = False: _
  1221.             mnuRename.Enabled = False
  1222.             PopupMenu mnupop
  1223.         End If
  1224.     End If
  1225. End Sub
  1226. Private Sub lvlistView_DblClick()
  1227.     If Not FileOpen Or FileIsEmpty Then Exit Sub
  1228.     If lvListView.SelectedItem Is Nothing Then Exit Sub
  1229.     If lvListView.SelectedItem.Tag <> vbNullString Then
  1230.         tvTreeView.SelectedItem = tvTreeView.Nodes.Item(lvListView.SelectedItem.Tag)
  1231.         tvTreeView_NodeClick tvTreeView.SelectedItem
  1232.     End If
  1233. End Sub
  1234. '**********************************************************************************
  1235. '==================================================================================
  1236. '                 DragDrop OPERATION               marco.sambento@netc.pt
  1237. '==================================================================================
  1238. Private Sub tvtreeview_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1239. If Not FileOpen Then Exit Sub
  1240. If FileIsEmpty Then
  1241.     If Button = vbRightButton Then PopupMenu mnuCreate
  1242.     Exit Sub
  1243. End If
  1244.     Set nodDrag = tvTreeView.SelectedItem ' Set the item being dragged.
  1245. End Sub
  1246. Public Sub lvListView_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1247. If Not FileOpen Then Exit Sub
  1248. If FileIsEmpty Then
  1249.     If Button = vbRightButton Then PopupMenu mnuCreate
  1250.     Exit Sub
  1251. End If
  1252. If lvListView.ListItems.Count = 0 Then Exit Sub
  1253.     If lvListView.SelectedItem.Tag <> vbNullString Then _
  1254.     Set nodDrag = tvTreeView.Nodes.Item(lvListView.SelectedItem.Tag)
  1255. End Sub
  1256. Private Sub tvtreeview_MouseMove _
  1257. (Button As Integer, Shift As Integer, x As Single, y As Single)
  1258.     On Error Resume Next
  1259.     If Button = vbLeftButton Then ' Signal a Drag operation.
  1260.         If nodDrag.Parent Is Nothing Then
  1261.         Else
  1262.             indrag = True   ' Set the flag to true.
  1263.             tvTreeView.DragIcon = ilSmall.ListImages.Item("Move").Picture 'dragicon
  1264.             tvTreeView.Drag vbBeginDrag ' Drag operation.
  1265.         End If
  1266.     End If
  1267. End Sub
  1268. Private Sub tvtreeview_DragDrop(Source As Control, x As Single, y As Single)
  1269.         If tvTreeView.DropHighlight Is Nothing Then GoTo clear
  1270.         If tvTreeView.DropHighlight = nodDrag.Parent Or _
  1271.         tvTreeView.DropHighlight = nodDrag Then GoTo clear
  1272.         
  1273.         If tvTreeView.DropHighlight.Parent Is Nothing Then _
  1274.         Set newSection = tvTreeView.DropHighlight Else _
  1275.         Set newSection = tvTreeView.DropHighlight.Parent
  1276.         'check for existing key
  1277.         If newSection.Children > 0 Then ' if exists keys in section
  1278.             numKey = newSection.Child.FirstSibling.Index
  1279. nextkey:
  1280.         'for each key child in dropped section, checks is already exists dropped key
  1281.                 If LCase(tvTreeView.Nodes.Item(numKey).Text) = LCase(nodDrag.Text) Then
  1282.                 Button = MsgBox("Key '" & nodDrag.Text & "' already exists in '" _
  1283.                 & newSection & "'!" & vbLf & "Replace?", vbExclamation + vbYesNo, "Replace Key...")
  1284.                 
  1285.                 If Button = vbNo Then GoTo clear
  1286.                 If Button = vbYes Then tvTreeView.Nodes.Remove numKey: GoTo Replace
  1287.                 End If
  1288.                 
  1289.                 If numKey <> newSection.Child.LastSibling.Index Then _
  1290.                 numKey = tvTreeView.Nodes.Item(numKey).Next.Index: GoTo nextkey
  1291.         End If
  1292. Replace:
  1293.         Section = nodDrag.Parent.Text
  1294.         Key = nodDrag.Text
  1295.         Value = GetVal(Section, Key)
  1296.         
  1297.         Create newSection, Key, Value
  1298.         With nodDrag
  1299.         tvTreeView.Nodes.Add newSection, tvwChild, , .Text, .Image, .SelectedImage
  1300.         End With
  1301.         If Not CopyNode Then 'if copyKey flag is set to false then delete dragged key
  1302.         DeleteKey Section, Key
  1303.         tvTreeView.Nodes.Remove nodDrag.Index
  1304.         End If
  1305. clear:
  1306.         Set tvTreeView.DropHighlight = Nothing
  1307.         indrag = False
  1308.         CopyNode = False
  1309.         tvTreeView.DragIcon = ilSmall.ListImages.Item("Move").Picture
  1310.         tvTreeView_NodeClick tvTreeView.SelectedItem
  1311. End Sub
  1312. Private Sub tvtreeview_DragOver(Source As Control, x As Single, y As Single, State As Integer)
  1313. On Error Resume Next
  1314.     If indrag = True Then
  1315.         If tvTreeView.HitTest(x, y).Parent Is Nothing Then
  1316.             ' Set DropHighlight to the mouse's coordinates.
  1317.             Set tvTreeView.DropHighlight = tvTreeView.HitTest(x, y)
  1318.         Else
  1319.             Set tvTreeView.DropHighlight = tvTreeView.HitTest(x, y).Parent
  1320.         End If
  1321.     End If
  1322. End Sub
  1323. '**********************************************************************************'
  1324. Private Sub mnuCollapse_Click()
  1325.     If tvTreeView.SelectedItem.Parent Is Nothing Then
  1326.         tvTreeView.SelectedItem.Expanded = False
  1327.     Else
  1328.         tvTreeView.SelectedItem.Parent.Expanded = False
  1329.     End If
  1330. End Sub
  1331. Private Sub mnuCollapseAll_Click()
  1332.     For i = 1 To tvTreeView.Nodes.Count
  1333.         tvTreeView.Nodes(i).Expanded = False
  1334.     Next i
  1335. End Sub
  1336. Private Sub mnuExpande_Click()
  1337.     tvTreeView.SelectedItem.Expanded = True
  1338. End Sub
  1339. Private Sub mnuExpandeAll_Click()
  1340.     For i = 1 To tvTreeView.Nodes.Count
  1341.         tvTreeView.Nodes(i).Expanded = True
  1342.     Next i
  1343. End Sub
  1344. Private Sub mnuRefresh_Click()
  1345.     mnuViewRefresh_Click
  1346. End Sub
  1347. Private Sub mnuFileExit_Click()
  1348.     Unload Me
  1349. End Sub
  1350. Private Sub mnuFileNew_Click()
  1351.     On Error GoTo error
  1352.     Dim Section As Node
  1353.     Dim Key As Node
  1354.     With CommonDialog1
  1355.         .CancelError = True
  1356.         .DialogTitle = "Create new INI File..."
  1357.         .InitDir = WinDir
  1358.         .ShowSave
  1359.         
  1360.         If .Filename <> vbNullString Then INIPath = .Filename
  1361.     End With
  1362.     Create "New Section", "New Key", "New Value"
  1363.     tvTreeView.Nodes.clear
  1364.     lvListView.ListItems.clear
  1365.     Set Section = tvTreeView.Nodes.Add(, , "New Section", "New Section", "Section", "selSection")
  1366.     tvTreeView.Nodes.Add Section, tvwChild, , "New Key", "Key", "selKey"
  1367. Me.Caption = App.Title & " - '" & StrConv(INIPath, vbProperCase) & "'"
  1368. Call CheckFile
  1369. numSections = 1
  1370. tvTreeView.SelectedItem = Section
  1371. tvTreeView_NodeClick tvTreeView.SelectedItem
  1372. Unload frmFind
  1373. error:
  1374. If Err = 32755 Then Exit Sub 'cancel was pressed
  1375. End Sub
  1376. Private Sub mnuFileOpen_Click()
  1377.     On Error GoTo error
  1378.     With CommonDialog1
  1379.         .CancelError = True
  1380.         .Flags = cdlOFNFileMustExist
  1381.         .InitDir = WinDir
  1382.         .ShowOpen
  1383.     End With
  1384.         If CommonDialog1.Filename <> vbNullString Then
  1385.         INIPath = CommonDialog1.Filename
  1386.         EnableDisable
  1387.         Call FilltvTreeView  ' fill tree and listview
  1388.         End If
  1389. error:
  1390. If Err = 32755 Then Exit Sub 'cancel was pressed
  1391. End Sub
  1392. Private Sub mnuFileClose_Click()
  1393.     INIPath = vbNullString
  1394.     EnableDisable
  1395.     Unload frmFind
  1396. End Sub
  1397. Private Sub mnuViewDetails_Click()
  1398.     mnuViewDetails.Checked = True
  1399.     lvListView.View = lvwReport
  1400.     mnuViewIcons.Checked = False
  1401.     mnuViewList.Checked = False
  1402.     mnuViewSmallIcons.Checked = False
  1403. End Sub
  1404. Private Sub mnuViewGridlines_Click()
  1405.     If mnuViewGridlines.Checked Then
  1406.         lvListView.GridLines = False
  1407.         tbToolbar.Buttons.Item("View Gridlines").Value = tbrUnpressed
  1408.         mnuViewGridlines.Checked = False
  1409.     Else
  1410.         lvListView.GridLines = True
  1411.         tbToolbar.Buttons.Item("View Gridlines").Value = tbrPressed
  1412.         mnuViewGridlines.Checked = True
  1413.     End If
  1414. End Sub
  1415. Private Sub mnuViewIcons_Click()
  1416.     mnuViewIcons.Checked = True
  1417.     lvListView.View = lvwIcon
  1418.     mnuViewDetails.Checked = False
  1419.     mnuViewList.Checked = False
  1420.     mnuViewSmallIcons.Checked = False
  1421. End Sub
  1422. Private Sub mnuViewList_Click()
  1423.     mnuViewList.Checked = True
  1424.     lvListView.View = lvwList
  1425.     mnuViewIcons.Checked = False
  1426.     mnuViewDetails.Checked = False
  1427.     mnuViewSmallIcons.Checked = False
  1428. End Sub
  1429. Private Sub mnuViewSmallIcons_Click()
  1430.     mnuViewSmallIcons.Checked = True
  1431.     lvListView.View = lvwSmallIcon
  1432.     mnuViewIcons.Checked = False
  1433.     mnuViewDetails.Checked = False
  1434.     mnuViewList.Checked = False
  1435. End Sub
  1436. Private Sub mnuViewStatusbar_Click()
  1437.     If mnuViewStatusbar.Checked Then
  1438.         sbStatusBar.Visible = False
  1439.         mnuViewStatusbar.Checked = False
  1440.     Else
  1441.         sbStatusBar.Visible = True
  1442.         mnuViewStatusbar.Checked = True
  1443.     End If
  1444.     SizeControls imgSplitter.Left
  1445. End Sub
  1446. Private Sub mnuViewToolbar_Click()
  1447.     If mnuViewToolbar.Checked = True Then
  1448.         tbToolbar.Visible = False
  1449.         mnuViewToolbar.Checked = False
  1450.     Else
  1451.         tbToolbar.Visible = True
  1452.         mnuViewToolbar.Checked = True
  1453.     End If
  1454.     SizeControls imgSplitter.Left
  1455. End Sub
  1456. Public Sub mnuEditRename_Click()
  1457.     ActiveControl.StartLabelEdit
  1458. End Sub
  1459. Private Sub mnuRename_Click()
  1460.     mnuEditRename_Click
  1461. End Sub
  1462. Private Sub mnuEditEditWordPad_Click()
  1463.     OpenWordPad
  1464. End Sub
  1465. Private Sub mnuEditDelete_Click()
  1466.     PopupMenu mnuDelete
  1467. End Sub
  1468. Private Sub mnuEditFind_Click()
  1469.     frmFind.Show
  1470. End Sub
  1471. Private Sub mnuViewRefresh_Click()
  1472.     FilltvTreeView
  1473. End Sub
  1474. Private Sub mnuAbout_Click()
  1475.     frmAbout.Show
  1476. End Sub
  1477. Private Function EnableDisable()
  1478. If Not FileOpen Then
  1479.         tvTreeView.Nodes.clear
  1480.         lvListView.ListItems.clear
  1481.         
  1482.         For Button = 1 To tbToolbar.Buttons.Count
  1483.             tbToolbar.Buttons.Item(Button).Enabled = False
  1484.         Next Button
  1485.         
  1486.             tbToolbar.Buttons.Item("New").Enabled = True
  1487.             tbToolbar.Buttons.Item("Open INI").Enabled = True
  1488.             tbToolbar.Buttons.Item("View Gridlines").Enabled = True
  1489.             tbToolbar.Buttons.Item("about").Enabled = True
  1490.             tbToolbar.Buttons.Item("Win.ini").Enabled = True
  1491.             tbToolbar.Buttons.Item("System.ini").Enabled = True
  1492.             tbToolbar.Buttons.Item("Exit").Enabled = True
  1493.             UpdateStatusBar
  1494.         
  1495.             mnuEdit.Enabled = False
  1496.             mnuViewRefresh.Enabled = False
  1497.             mnuFileClose.Enabled = False
  1498.                        
  1499.             Me.Caption = StrConv(App.Title, vbProperCase)
  1500.             For Button = 1 To tbToolbar.Buttons.Count
  1501.                 tbToolbar.Buttons.Item(Button).Enabled = True
  1502.             Next Button
  1503.             
  1504.             mnuEdit.Enabled = True
  1505.             mnuViewRefresh.Enabled = True
  1506.             mnuFileClose.Enabled = True
  1507. End If
  1508. End Function
  1509. Function CheckFile()
  1510.     If tvTreeView.Nodes.Count = 0 Then  ' if tree hasn't nodes
  1511.         FileIsEmpty = True
  1512.         mnuEditDelete.Enabled = False
  1513.         mnuEditRename.Enabled = False
  1514.         mnuEditFind.Enabled = False
  1515.         
  1516.         For Button = 1 To tbToolbar.Buttons.Count
  1517.             tbToolbar.Buttons.Item(Button).Enabled = False
  1518.         Next Button
  1519.         
  1520.             tbToolbar.Buttons.Item("New").Enabled = True
  1521.             tbToolbar.Buttons.Item("Open INI").Enabled = True
  1522.             tbToolbar.Buttons.Item("Close").Enabled = True
  1523.             tbToolbar.Buttons.Item("View Gridlines").Enabled = True
  1524.             tbToolbar.Buttons.Item("about").Enabled = True
  1525.             tbToolbar.Buttons.Item("Win.ini").Enabled = True
  1526.             tbToolbar.Buttons.Item("System.ini").Enabled = True
  1527.             tbToolbar.Buttons.Item("Exit").Enabled = True
  1528.             tbToolbar.Buttons.Item("WordPad").Enabled = True
  1529.             tbToolbar.Buttons.Item("Refresh").Enabled = True
  1530.         
  1531.         sbStatusBar.Panels.Item(1).Text = vbNullString
  1532.         sbStatusBar.Panels.Item(2).Text = vbNullString
  1533.     Else
  1534.         FileIsEmpty = False
  1535.         
  1536.         For Button = 1 To tbToolbar.Buttons.Count
  1537.             tbToolbar.Buttons.Item(Button).Enabled = True
  1538.         Next Button
  1539.         
  1540.         mnuEditDelete.Enabled = True
  1541.         mnuEditRename.Enabled = True
  1542.         mnuEditFind.Enabled = True
  1543.     End If
  1544. End Function
  1545. Public Function UpdateStatusBar()
  1546.     If Not FileIsEmpty And FileOpen Then
  1547.     Set Node = tvTreeView.SelectedItem
  1548.         If Node.Parent Is Nothing Then
  1549.             sbStatusBar.Panels.Item(1).Text = numSections & " Sections - " & tvTreeView.Nodes.Count - numSections & " Keys" 'for sections
  1550.             sbStatusBar.Panels.Item(2).Text = lvListView.ListItems.Count & " keys/values in section '" & Node & "'"
  1551.         Else
  1552.             sbStatusBar.Panels.Item(1).Text = Node.Parent.Children & " Keys in '" & Node.Parent & "'" 'keys
  1553.             sbStatusBar.Panels.Item(2).Text = "Value '" & lvListView.SelectedItem & "' in key '" & Node & "'"
  1554.         End If
  1555.     Else
  1556.         sbStatusBar.Panels.Item(1).Text = vbNullString
  1557.         sbStatusBar.Panels.Item(2).Text = vbNullString
  1558.     End If
  1559. End Function
  1560. '**********************************************************************************
  1561. '==================================================================================
  1562. '              RESIZE CONTROLS OPERATION           marco.sambento@netc.pt
  1563. '==================================================================================
  1564. Private Sub Form_Resize()
  1565.     If Me.WindowState = vbNormal Then
  1566.         If Me.Width < 10000 Then Me.Width = 10000
  1567.         Me.Move (Screen.Width - Me.Width) / 2, _
  1568.         (Screen.Height - Me.Height) / 2, Me.Width, Me.Height
  1569.     End If
  1570.     SizeControls imgSplitter.Left
  1571. End Sub
  1572. Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1573.     With imgSplitter
  1574.         picSplitter.Move .Left, .Top, .Width \ 4, .Height - 20
  1575.     End With
  1576.     picSplitter.Visible = True
  1577.     mbMoving = True
  1578. End Sub
  1579. Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  1580.     Dim sglPos As Single
  1581.     If mbMoving Then
  1582.         sglPos = x + imgSplitter.Left
  1583.         If sglPos < sglSplitLimit Then
  1584.             picSplitter.Left = sglSplitLimit
  1585.         ElseIf sglPos > Me.Width - sglSplitLimit * 3 Then
  1586.             picSplitter.Left = Me.Width - sglSplitLimit * 3
  1587.         Else
  1588.             picSplitter.Left = sglPos
  1589.         End If
  1590.     End If
  1591. End Sub
  1592. Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  1593.     SizeControls picSplitter.Left
  1594.     picSplitter.Visible = False
  1595.     mbMoving = False
  1596. End Sub
  1597. Sub SizeControls(x As Single)
  1598.     Dim numColumns As Integer
  1599.     Dim Column As Integer
  1600.     Dim sizeColumn As Integer
  1601.     'set the width
  1602.     If x < 1500 Then x = 1500
  1603.     If x > (Me.Width - 1500) Then x = Me.Width - 1500
  1604.     tvTreeView.Width = x - imgSplitter.Width
  1605.     sbStatusBar.Panels.Item(1).Width = x
  1606.     imgSplitter.Left = x
  1607.     lvListView.Left = x + imgSplitter.Width / 2
  1608.     lvListView.Width = Me.ScaleWidth - lvListView.Left - tvTreeView.Left
  1609.     numColumns = lvListView.ColumnHeaders.Count
  1610.     sizeColumn = (lvListView.Width / numColumns) - 180
  1611.     For Column = 1 To numColumns
  1612.         lvListView.ColumnHeaders.Item(Column).Width = sizeColumn
  1613.     Next Column
  1614.     'set the top
  1615.     If tbToolbar.Visible Then
  1616.         tvTreeView.Top = tbToolbar.Height + 120
  1617.     Else
  1618.         tvTreeView.Top = 120
  1619.     End If
  1620.   lvListView.Top = tvTreeView.Top
  1621.     'set the height
  1622.     If sbStatusBar.Visible Then
  1623.         tvTreeView.Height = Me.ScaleHeight - tvTreeView.Top - sbStatusBar.Height
  1624.     Else
  1625.         tvTreeView.Height = Me.ScaleHeight - tvTreeView.Top - 80
  1626.     End If
  1627.     lvListView.Height = tvTreeView.Height
  1628.     imgSplitter.Top = tvTreeView.Top
  1629.     imgSplitter.Height = tvTreeView.Height
  1630. End Sub
  1631. '**********************************************************************************
  1632.