home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / cssProject190224302001.psc / Misc / ProjectAnalyzer / frmMain.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-04-27  |  28.5 KB  |  680 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. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  5. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "tabctl32.ocx"
  6. Begin VB.Form frmMain 
  7.    AutoRedraw      =   -1  'True
  8.    Caption         =   "No Project Loaded"
  9.    ClientHeight    =   8040
  10.    ClientLeft      =   60
  11.    ClientTop       =   630
  12.    ClientWidth     =   10125
  13.    Icon            =   "frmMain.frx":0000
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   8040
  17.    ScaleWidth      =   10125
  18.    StartUpPosition =   2  'CenterScreen
  19.    Begin MSComctlLib.ImageList imgMain 
  20.       Left            =   5670
  21.       Top             =   5550
  22.       _ExtentX        =   1005
  23.       _ExtentY        =   1005
  24.       BackColor       =   -2147483643
  25.       ImageWidth      =   16
  26.       ImageHeight     =   16
  27.       MaskColor       =   12632256
  28.       _Version        =   393216
  29.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  30.          NumListImages   =   8
  31.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  32.             Picture         =   "frmMain.frx":0442
  33.             Key             =   ""
  34.          EndProperty
  35.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  36.             Picture         =   "frmMain.frx":0894
  37.             Key             =   "Form"
  38.          EndProperty
  39.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  40.             Picture         =   "frmMain.frx":0CE6
  41.             Key             =   "Class"
  42.          EndProperty
  43.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  44.             Picture         =   "frmMain.frx":1138
  45.             Key             =   "Module"
  46.          EndProperty
  47.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  48.             Picture         =   "frmMain.frx":158A
  49.             Key             =   "Procedure"
  50.          EndProperty
  51.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  52.             Picture         =   "frmMain.frx":19DC
  53.             Key             =   "Attribute"
  54.          EndProperty
  55.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  56.             Picture         =   "frmMain.frx":1E2E
  57.             Key             =   "Argument"
  58.          EndProperty
  59.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  60.             Picture         =   "frmMain.frx":2280
  61.             Key             =   "Control"
  62.          EndProperty
  63.       EndProperty
  64.    End
  65.    Begin TabDlg.SSTab tabMain 
  66.       Height          =   4515
  67.       Left            =   4050
  68.       TabIndex        =   3
  69.       Top             =   210
  70.       Width           =   5925
  71.       _ExtentX        =   10451
  72.       _ExtentY        =   7964
  73.       _Version        =   393216
  74.       Tabs            =   2
  75.       TabsPerRow      =   2
  76.       TabHeight       =   520
  77.       TabCaption(0)   =   "Procedures that I call"
  78.       TabPicture(0)   =   "frmMain.frx":2512
  79.       Tab(0).ControlEnabled=   -1  'True
  80.       Tab(0).Control(0)=   "lstProcMapping(0)"
  81.       Tab(0).Control(0).Enabled=   0   'False
  82.       Tab(0).ControlCount=   1
  83.       TabCaption(1)   =   "Procedures that call me"
  84.       TabPicture(1)   =   "frmMain.frx":252E
  85.       Tab(1).ControlEnabled=   0   'False
  86.       Tab(1).Control(0)=   "lstProcMapping(1)"
  87.       Tab(1).ControlCount=   1
  88.       Begin MSComctlLib.ListView lstProcMapping 
  89.          Height          =   3600
  90.          Index           =   0
  91.          Left            =   240
  92.          TabIndex        =   4
  93.          Top             =   660
  94.          Width           =   5445
  95.          _ExtentX        =   9604
  96.          _ExtentY        =   6350
  97.          View            =   3
  98.          LabelEdit       =   1
  99.          LabelWrap       =   -1  'True
  100.          HideSelection   =   0   'False
  101.          FullRowSelect   =   -1  'True
  102.          _Version        =   393217
  103.          ForeColor       =   -2147483640
  104.          BackColor       =   -2147483643
  105.          BorderStyle     =   1
  106.          Appearance      =   1
  107.          NumItems        =   3
  108.          BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  109.             Text            =   "Parent"
  110.             Object.Width           =   2646
  111.          EndProperty
  112.          BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  113.             SubItemIndex    =   1
  114.             Text            =   "Procedure Name"
  115.             Object.Width           =   2646
  116.          EndProperty
  117.          BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  118.             SubItemIndex    =   2
  119.             Text            =   "Possible Errors"
  120.             Object.Width           =   4057
  121.          EndProperty
  122.       End
  123.       Begin MSComctlLib.ListView lstProcMapping 
  124.          Height          =   3600
  125.          Index           =   1
  126.          Left            =   -74760
  127.          TabIndex        =   5
  128.          Top             =   660
  129.          Width           =   5445
  130.          _ExtentX        =   9604
  131.          _ExtentY        =   6350
  132.          View            =   3
  133.          LabelEdit       =   1
  134.          LabelWrap       =   -1  'True
  135.          HideSelection   =   0   'False
  136.          FullRowSelect   =   -1  'True
  137.          _Version        =   393217
  138.          ForeColor       =   -2147483640
  139.          BackColor       =   -2147483643
  140.          BorderStyle     =   1
  141.          Appearance      =   1
  142.          NumItems        =   3
  143.          BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  144.             Text            =   "Parent"
  145.             Object.Width           =   2646
  146.          EndProperty
  147.          BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  148.             SubItemIndex    =   1
  149.             Text            =   "Procedure Name"
  150.             Object.Width           =   2646
  151.          EndProperty
  152.          BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  153.             SubItemIndex    =   2
  154.             Text            =   "Possible Errors"
  155.             Object.Width           =   4057
  156.          EndProperty
  157.       End
  158.    End
  159.    Begin RichTextLib.RichTextBox txtCode 
  160.       Height          =   2865
  161.       Left            =   150
  162.       TabIndex        =   2
  163.       Top             =   5040
  164.       Width           =   9825
  165.       _ExtentX        =   17330
  166.       _ExtentY        =   5054
  167.       _Version        =   393217
  168.       BackColor       =   16777215
  169.       ReadOnly        =   -1  'True
  170.       ScrollBars      =   3
  171.       TextRTF         =   $"frmMain.frx":254A
  172.    End
  173.    Begin MSComDlg.CommonDialog cdgMain 
  174.       Left            =   330
  175.       Top             =   2070
  176.       _ExtentX        =   847
  177.       _ExtentY        =   847
  178.       _Version        =   393216
  179.    End
  180.    Begin MSComctlLib.TreeView trvView 
  181.       Height          =   4485
  182.       Left            =   150
  183.       TabIndex        =   0
  184.       Top             =   210
  185.       Width           =   3765
  186.       _ExtentX        =   6641
  187.       _ExtentY        =   7911
  188.       _Version        =   393217
  189.       HideSelection   =   0   'False
  190.       Indentation     =   529
  191.       LabelEdit       =   1
  192.       Sorted          =   -1  'True
  193.       Style           =   5
  194.       FullRowSelect   =   -1  'True
  195.       SingleSel       =   -1  'True
  196.       BorderStyle     =   1
  197.       Appearance      =   1
  198.    End
  199.    Begin VB.Label lblCode 
  200.       Alignment       =   2  'Center
  201.       Caption         =   "Code of selected module/procedure"
  202.       Height          =   225
  203.       Left            =   180
  204.       TabIndex        =   1
  205.       Top             =   4830
  206.       Width           =   9735
  207.    End
  208.    Begin VB.Menu mnuFile 
  209.       Caption         =   "&File"
  210.       Begin VB.Menu mnuOpen 
  211.          Caption         =   "&Open Project..."
  212.          Shortcut        =   ^O
  213.       End
  214.       Begin VB.Menu SEP1 
  215.          Caption         =   "-"
  216.       End
  217.       Begin VB.Menu mnuPrintC 
  218.          Caption         =   "Print..."
  219.          Shortcut        =   ^P
  220.       End
  221.       Begin VB.Menu SEP2 
  222.          Caption         =   "-"
  223.       End
  224.       Begin VB.Menu mnuExit 
  225.          Caption         =   "E&xit"
  226.       End
  227.    End
  228.    Begin VB.Menu mnuTools 
  229.       Caption         =   "&Tools"
  230.       Begin VB.Menu mnuThreatMan 
  231.          Caption         =   "&Threat Manager"
  232.       End
  233.       Begin VB.Menu SEP3 
  234.          Caption         =   "-"
  235.       End
  236.       Begin VB.Menu mnuScan 
  237.          Caption         =   "&Scan for Errors..."
  238.          Shortcut        =   {F5}
  239.       End
  240.       Begin VB.Menu mnuThreat 
  241.          Caption         =   "&View Possible Threats..."
  242.          Shortcut        =   {F7}
  243.       End
  244.       Begin VB.Menu SEP4 
  245.          Caption         =   "-"
  246.       End
  247.       Begin VB.Menu mnuOptions 
  248.          Caption         =   "&Options..."
  249.       End
  250.    End
  251.    Begin VB.Menu mnuPopUp 
  252.       Caption         =   "PopUp"
  253.       Begin VB.Menu mnuPrint 
  254.          Caption         =   "&Print"
  255.       End
  256.       Begin VB.Menu mnuJump 
  257.          Caption         =   "&Jump to Procedure"
  258.       End
  259.       Begin VB.Menu SEP5 
  260.          Caption         =   "-"
  261.       End
  262.       Begin VB.Menu mnuCancel 
  263.          Caption         =   "Cancel"
  264.       End
  265.    End
  266. Attribute VB_Name = "frmMain"
  267. Attribute VB_GlobalNameSpace = False
  268. Attribute VB_Creatable = False
  269. Attribute VB_PredeclaredId = True
  270. Attribute VB_Exposed = False
  271. Option Explicit
  272. Dim objModule As clsModule
  273. Dim intProcMapping As Integer
  274. Private Sub Form_Load()
  275.     lngHeigth = 8730
  276.     lngWidth = Me.Width
  277.     trvView.ImageList = imgMain
  278.     mnuPopup.Visible = False
  279.     mnuPrintC.Enabled = False
  280.     OpenProject
  281. End Sub
  282. Private Sub LoadProject()
  283.     Dim intFreeFile As Integer
  284.     Dim strData As String
  285.     Dim intCounter2 As Integer
  286.     Dim intLooper As Integer
  287.     intFreeFile = FreeFile
  288.     'opening Visual Basic project file
  289.     Open strProjectPath & strProjectFileName For Input As intFreeFile
  290.     Do While Not EOF(intFreeFile)
  291.         'looping through each line within the VBP file
  292.         'to determine their purpose in life
  293.         Line Input #intFreeFile, strData
  294.         If InStr(1, UCase(strData), "FORM=") = 1 Then
  295.             'we have a reference to a form here, let's add to our
  296.             'module collection
  297.             Set objModule = New clsModule
  298.             objModule.ModLoc = Replace(Mid(strData, InStr(1, strData, "=") + 1), Chr(34), "")
  299.             objModule.ModType = "Form"
  300.             'now let's load any procedures, controls or variables for this module
  301.             LoadModule strProjectPath & objModule.ModLoc
  302.             colModules.Add objModule
  303.             Set objModule = Nothing
  304.         ElseIf InStr(1, UCase(strData), "MODULE=") = 1 Then
  305.             'we have a module here, let's add it to our
  306.             'module collection
  307.             Set objModule = New clsModule
  308.             If InStr(1, strData, ";") > 1 Then
  309.                 'sometimes visual basic places the name
  310.                 'within the VBP file, so let's parce it
  311.                 objModule.ModLoc = Trim(Replace(Mid(strData, InStr(1, strData, ";") + 1), Chr(34), ""))
  312.             Else
  313.                 objModule.ModLoc = Replace(Mid(strData, InStr(1, strData, "=") + 1), Chr(34), "")
  314.             End If
  315.             'now let's load any procedures, controls or variables for this module
  316.             objModule.ModType = "Module"
  317.             LoadModule strProjectPath & objModule.ModLoc
  318.             colModules.Add objModule
  319.             Set objModule = Nothing
  320.         ElseIf InStr(1, UCase(strData), "CLASS=") = 1 Then
  321.             'we have a class module here, let's add it to our
  322.             'module collection
  323.             Set objModule = New clsModule
  324.             If InStr(1, strData, ";") > 1 Then
  325.                 'sometimes visual basic places the name
  326.                 'within the VBP file, so let's parce it
  327.                 objModule.ModLoc = Trim(Replace(Mid(strData, InStr(1, strData, ";") + 1), Chr(34), ""))
  328.             Else
  329.                 objModule.ModLoc = Replace(Mid(strData, InStr(1, strData, "=") + 1), Chr(34), "")
  330.             End If
  331.             objModule.ModType = "Class"
  332.             'now let's load any procedures, controls or variables for this module
  333.             LoadModule strProjectPath & objModule.ModLoc
  334.             colModules.Add objModule
  335.             Set objModule = Nothing
  336.         ElseIf InStr(1, UCase(strData), "NAME=") = 1 Then
  337.             strProjectName = Replace(Mid(strData, InStr(1, strData, "=") + 1), Chr(34), "")
  338.         End If
  339.     Loop
  340.     Close
  341.     With trvView.Nodes
  342.         .Add , , "ROOT", strProjectName, 1
  343.         
  344.         intLooper = 0
  345.         For Each objModule In colModules
  346.             intLooper = intLooper + 1
  347.             
  348.             .Add "ROOT", tvwChild, "M" & intLooper, objModule.ModName & ":" & objModule.ModType, objModule.ModType
  349.             
  350.             'adding procedures here
  351.             For intCounter = 0 To objModule.ProcedureCount - 1
  352.                 .Add "M" & intLooper, tvwChild, "PP" & objModule.GetProcIndex(intCounter), colProcedures(objModule.GetProcIndex(intCounter)).ProcName, "Procedure"
  353.                 .Add "PP" & objModule.GetProcIndex(intCounter), tvwChild, "PS" & objModule.GetProcIndex(intCounter), "Scope: " & colProcedures(objModule.GetProcIndex(intCounter)).ProcScope, "Attribute"
  354.                 .Add "PP" & objModule.GetProcIndex(intCounter), tvwChild, "PT" & objModule.GetProcIndex(intCounter), "Type: " & colProcedures(objModule.GetProcIndex(intCounter)).ProcType, "Attribute"
  355.                 .Add "PP" & objModule.GetProcIndex(intCounter), tvwChild, "PR" & objModule.GetProcIndex(intCounter), "ReturnType: " & colProcedures(objModule.GetProcIndex(intCounter)).ProcReturn, "Attribute"
  356.                 .Add "PP" & objModule.GetProcIndex(intCounter), tvwChild, "PA" & objModule.GetProcIndex(intCounter), "Arguments: " & colProcedures(objModule.GetProcIndex(intCounter)).ArgCount, "Attribute"
  357.                 
  358.                 For intCounter2 = 1 To colProcedures(objModule.GetProcIndex(intCounter)).ArgCount
  359.                     .Add "PA" & objModule.GetProcIndex(intCounter), tvwChild, , colProcedures(objModule.GetProcIndex(intCounter)).colArguments(intCounter2).VarName, "Argument"
  360.                 Next intCounter2
  361.             Next intCounter
  362.             
  363.             'adding controls here
  364.             For intCounter = 0 To objModule.ControlCount - 1
  365.                 .Add "M" & intLooper, tvwChild, "C" & objModule.GetCtrIndex(intCounter), colControls(objModule.GetCtrIndex(intCounter)).CtrName & ":" & colControls(objModule.GetCtrIndex(intCounter)).CtrType, "Control"
  366.             Next intCounter
  367.             
  368.             'adding modular level variables here
  369.             For intCounter = 0 To objModule.VarCount - 1
  370.                 .Add "M" & intLooper, tvwChild, "V" & objModule.GetVarIndex(intCounter), colVariables(objModule.GetVarIndex(intCounter)).VarName & ":" & colVariables(objModule.GetVarIndex(intCounter)).VarType, "Argument"
  371.             Next intCounter
  372.             
  373.         Next
  374.     End With
  375.     Set objModule = Nothing
  376. End Sub
  377. Private Sub LoadModule(strPath As String)
  378.     Dim intFreeFile As Integer
  379.     Dim strData As String
  380.     Dim objControl As clsControl
  381.     Dim objProcedure As clsProcedure
  382.     Dim objVariable As clsVariable
  383.     Dim strCode As String
  384.     Dim strModCode As String
  385.     Dim intStart As Integer
  386.     Dim strTemp As String
  387.     Dim strArguments() As String
  388.     intFreeFile = FreeFile
  389.     Open strPath For Input As intFreeFile
  390.     strModCode = ""
  391.     Do While Not EOF(intFreeFile)
  392.         Line Input #intFreeFile, strData
  393.         If InStr(1, UCase(strData), "ATTRIBUTE VB_NAME = ") = 1 Then
  394.             'we have the name of the module here;
  395.             'let's set the name property
  396.             objModule.ModName = Replace(Mid(strData, InStr(1, UCase(strData), "ATTRIBUTE VB_NAME = ") + 20), Chr(34), "")
  397.         ElseIf (InStr(1, UCase(Trim(strData)), "BEGIN VB.") = 1) And (InStr(1, UCase(Trim(strData)), UCase(objModule.ModType)) = 0) Then
  398.             'we have a control of some sort here;
  399.             'let's add it to our control collection
  400.             Set objControl = New clsControl
  401.             intStart = InStr(1, UCase(strData), "BEGIN VB.") + 9
  402.             With objControl
  403.                 .CtrType = Mid(strData, intStart, InStr(intStart, strData, " ") - intStart)
  404.                 .CtrName = Trim(Mid(strData, InStr(intStart, strData, " ")))
  405.                 .CtrCode = "Name: " & .CtrName & vbCrLf & "Type: " & .CtrType
  406.             End With
  407.             objModule.AddControl objControl
  408.             Set objControl = Nothing
  409.         ElseIf ((InStr(1, UCase(strData), " SUB ") > 1) Or (InStr(1, UCase(strData), " FUNCTION ") > 1) Or (InStr(1, UCase(strData), " PROPERTY ") > 1)) And (InStr(1, strData, "(") > 5) And (InStr(1, strData, ")") > 6) Then
  410.             'we have a procedure here;
  411.             'let's add it to our procedure collection
  412.             strCode = strData & vbCrLf
  413.             
  414.             Set objProcedure = New clsProcedure
  415.             With objProcedure
  416.                 .ProcParentID = colModules.Count + 1
  417.                 .ProcScope = "Private"
  418.                 If (InStr(1, UCase(strData), "PRIVATE ")) Or (InStr(1, UCase(strData), "PUBLIC ")) Or (InStr(1, UCase(strData), "FRIEND ")) Or (InStr(1, UCase(strData), "STATIC ")) Then .ProcScope = Left(strData, InStr(1, strData, " ") - 1)
  419.                 
  420.                 intStart = InStr(1, UCase(strData), "SUB ") + InStr(1, UCase(strData), "FUNCTION ") + InStr(1, UCase(strData), "PROPERTY ")
  421.                 
  422.                 .ProcType = Mid(strData, intStart, (InStr(intStart + 1, strData, " ")) + (Abs((InStr(1, UCase(strData), "PROPERTY ") > 0) * 4)) - intStart)
  423.                                 
  424.                 intStart = (InStr(intStart + 1, strData, " ")) + (Abs((InStr(1, UCase(strData), " PROPERTY GET ") > 0) * 4)) + (Abs((InStr(1, UCase(strData), " PROPERTY LET ") > 0) * 4)) + (Abs((InStr(1, UCase(strData), " PROPERTY SET ") > 0) * 4)) + 1
  425.                 .ProcName = Mid(strData, intStart, InStr(1, strData, "(") - intStart)
  426.                 
  427.                 intStart = InStr(1, strData, "(") + 1
  428.                 strTemp = Mid(strData, intStart, InStr(intStart, strData, ")") - intStart)
  429.                 If Len(strTemp) > 2 Then
  430.                     strArguments() = Split(strTemp, ",")
  431.                     For intCounter = 0 To UBound(strArguments)
  432.                         Set objVariable = New clsVariable
  433.                         With objVariable
  434.                             .VarName = Trim(strArguments(intCounter))
  435.                             intStart = InStr(1, UCase(strArguments(intCounter)), " AS ") + 4
  436.                             If InStr(intStart, strArguments(intCounter), " = ") Then
  437.                                 .VarType = Mid(strArguments(intCounter), intStart, InStr(intStart, strArguments(intCounter), " = ") - intStart)
  438.                             Else
  439.                                 .VarType = Mid(strArguments(intCounter), intStart)
  440.                             End If
  441.                         End With
  442.                         .AddArguments objVariable
  443.                         Set objVariable = Nothing
  444.                     Next intCounter
  445.                 End If
  446.                 
  447.                 .ProcReturn = "None"
  448.                 intStart = InStr(1, strData, ")") + 1
  449.                 If InStr(intStart, UCase(strData), " AS ") Then .ProcReturn = Mid(strData, intStart + 4)
  450.                 
  451.                 If InStr(1, UCase(strData), "DECLARE") = 0 Then
  452.                     If InStr(1, .ProcType, " ") > 0 Then
  453.                         strTemp = UCase(Left(.ProcType, InStr(1, .ProcType, " ") - 1))
  454.                     Else
  455.                         strTemp = UCase(.ProcType)
  456.                     End If
  457.                     
  458.                     Line Input #intFreeFile, strData
  459.                     strCode = strCode & strData & vbCrLf
  460.                     
  461.                     Do While ((InStr(1, UCase(strData), "END " & strTemp)) = 0)
  462.                         Line Input #intFreeFile, strData
  463.                         strCode = strCode & strData & vbCrLf
  464.                     Loop
  465.                 End If
  466.                  .ProcCode = strCode
  467.             End With
  468.             objModule.AddProcedure objProcedure
  469.             Set objProcedure = Nothing
  470.             strModCode = strModCode & strCode & vbCrLf
  471.         ElseIf ((InStr(1, UCase(strData), "PRIVATE ")) Or (InStr(1, UCase(strData), "PUBLIC ")) Or (InStr(1, UCase(strData), "DIM ")) Or (InStr(1, UCase(strData), "GLOBAL "))) And ((InStr(1, UCase(strData), " TYPE ") = 0)) And ((InStr(1, UCase(strData), " ENUM ") = 0)) Then
  472.             'we have a variable here;
  473.             'let's add it to our variable collection
  474.             Set objVariable = New clsVariable
  475.             With objVariable
  476.                 .VarScope = Left(strData, InStr(1, strData, " ") - 1)
  477.                 intStart = Len(.VarScope) + InStr(1, UCase(strData), "CONST") + 1
  478.                 .VarName = Trim(Mid(strData, intStart, InStr(intStart, UCase(strData), " AS ") - intStart))
  479.                 intStart = InStr(1, UCase(strData), " AS ") + 4
  480.                 If InStr(intStart, strData, " ") > 0 Then
  481.                     .VarType = Mid(strData, intStart, InStr(intStart, strData, " ") - intStart)
  482.                 Else
  483.                     .VarType = Mid(strData, intStart)
  484.                 End If
  485.                 .VarCode = "Location: " & objModule.ModName & vbCrLf & "Scope: " & .VarScope & vbCrLf & "Name: " & .VarName & vbCrLf & "Type: " & .VarType
  486.             End With
  487.             
  488.             
  489.             objModule.AddVariable objVariable
  490.             Set objVariable = Nothing
  491.             
  492.             strModCode = strModCode & strData & vbCrLf
  493.         End If
  494.         
  495.     Loop
  496.     objModule.ModCode = strModCode
  497.     Close intFreeFile
  498. End Sub
  499. Private Sub Form_Resize()
  500.     If Me.WindowState <> 1 Then
  501.         Me.Height = lngHeigth
  502.         Me.Width = lngWidth
  503.     End If
  504. End Sub
  505. Private Sub Form_Unload(Cancel As Integer)
  506.     Set colModules = Nothing
  507.     Set colProcedures = Nothing
  508.     Set colControls = Nothing
  509.     Set colVariables = Nothing
  510.     Close
  511. End Sub
  512. Private Sub lstProcMapping_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  513.     If (Button = 2) And (lstProcMapping(Index).ListItems.Count > 0) Then
  514.         intProcMapping = Index
  515.         mnuJump.Visible = True
  516.         mnuPrint.Visible = False
  517.         Me.PopupMenu mnuPopup
  518.     End If
  519. End Sub
  520. Private Sub mnuExit_Click()
  521.     Unload Me
  522. End Sub
  523. Private Sub mnuJump_Click()
  524.     Dim strTemp As String
  525.     strTemp = Mid(lstProcMapping(intProcMapping).SelectedItem.Key, 2, InStr(1, lstProcMapping(intProcMapping).SelectedItem.Key, "X") - 2)
  526.     trvView.Nodes("PP" & strTemp).Selected = True
  527.     txtCode.Text = colProcedures(Val(strTemp)).ProcCode
  528.     MapProcedure (Val(strTemp))
  529. End Sub
  530. Private Sub mnuOpen_Click()
  531.     OpenProject
  532. End Sub
  533. Private Sub mnuOptions_Click()
  534.     frmOptions.Show vbModal
  535. End Sub
  536. Private Sub mnuPrint_Click()
  537.     On Error GoTo EvalErr
  538.     With cdgMain
  539.         .Flags = cdlPDReturnDC + cdlPDNoPageNums
  540.         If txtCode.SelLength = 0 Then
  541.             .Flags = .Flags + cdlPDAllPages
  542.         Else
  543.             .Flags = .Flags + cdlPDSelection
  544.         End If
  545.         .ShowPrinter
  546.         Printer.Print ""
  547.         txtCode.SelPrint .hDC
  548.     End With
  549.     Exit Sub
  550. EvalErr:
  551.     If Err.Number <> 32755 Then MsgBox Err.Number & vbCr & Err.Description
  552.     Exit Sub
  553. End Sub
  554. Private Sub mnuPrintC_Click()
  555.     mnuPrint_Click
  556. End Sub
  557. Private Sub mnuThreat_Click()
  558.     PopulateThreats
  559.     frmThreats.Show
  560. End Sub
  561. Private Sub mnuThreatMan_Click()
  562.     frmThreatManager.Show vbModal
  563. End Sub
  564. Private Sub trvView_NodeClick(ByVal Node As MSComctlLib.Node)
  565.     'a node was clicked, so we need to show the code/information
  566.     If InStr(1, Node.Key, "P") = 1 Then
  567.         txtCode.Text = colProcedures(Val(Mid(Node.Key, 3))).ProcCode
  568.         MapProcedure (Val(Mid(Node.Key, 3)))
  569.     ElseIf InStr(1, Node.Key, "M") = 1 Then
  570.         txtCode.Text = colModules(Val(Mid(Node.Key, 2))).ModCode
  571.     ElseIf InStr(1, Node.Key, "C") = 1 Then
  572.         txtCode.Text = "ACTIVE X CONTROL" & vbCrLf & colControls(Val(Mid(Node.Key, 2))).CtrCode
  573.     ElseIf InStr(1, Node.Key, "V") = 1 Then
  574.         txtCode.Text = "VARIABLE/OBJECT" & vbCrLf & colVariables(Val(Mid(Node.Key, 2))).VarCode
  575.     Else
  576.         txtCode.Text = ""
  577.         lstProcMapping(0).ListItems.Clear
  578.         lstProcMapping(1).ListItems.Clear
  579.     End If
  580.     mnuPrintC.Enabled = Len(txtCode.Text) > 0
  581. End Sub
  582. Private Sub OpenProject()
  583.     On Error GoTo EvalErr
  584.     Set colModules = Nothing
  585.     Set colProcedures = Nothing
  586.     Set colControls = Nothing
  587.     Set colVariables = Nothing
  588.     trvView.Nodes.Clear
  589.     Unload frmThreats
  590.     Set colModules = New Collection
  591.     Set colProcedures = New Collection
  592.     Set colControls = New Collection
  593.     Set colVariables = New Collection
  594.     With cdgMain
  595.         .CancelError = True
  596.         .Flags = cdlOFNFileMustExist + cdlOFNHideReadOnly
  597.         .Filter = "Visual Basic Projects |*.vbp|"
  598.         .DialogTitle = "Project Analyzer"
  599.         .ShowOpen
  600.         strProjectFileName = .FileTitle
  601.         strProjectPath = Left(.FileName, InStr(1, .FileName, strProjectFileName) - 1)
  602.         
  603.         Me.Caption = "Common Sense Software Project Analyzer   [" & strProjectFileName & "]"
  604.         
  605.         LoadProject
  606.         
  607.         txtCode.Text = ""
  608.         
  609.     End With
  610.     If trvView.Nodes.Count > 0 Then trvView.Nodes.Item(1).Selected = True
  611.     Exit Sub
  612. EvalErr:
  613.     If Err.Number <> 32755 Then MsgBox Err.Number & vbCr & Err.Description
  614.     Unload Me
  615. End Sub
  616. Private Sub txtCode_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  617.     If (Button = 2) And (Len(txtCode.Text) > 0) Then
  618.         mnuJump.Visible = False
  619.         mnuPrint.Visible = True
  620.         Me.PopupMenu mnuPopup
  621.     End If
  622. End Sub
  623. Public Sub MapProcedure(intProcID As Integer)
  624.     Dim strParced() As String
  625.     Dim intLooper As Integer
  626.     Dim intLooper2 As Integer
  627.     Dim strTmpProcName As String
  628.     Dim strTmpProcParent As String
  629.     Dim blnProcResolved As Boolean
  630.     Dim intLocalProcID As Integer
  631.     Dim intStart As Integer
  632.     Dim intEnd As String
  633.     lstProcMapping(0).ListItems.Clear
  634.     lstProcMapping(1).ListItems.Clear
  635.     cMarue
  636.         .Flags = cdlOFNFileMustExite Sub Form_Leo
  637. Private Si)kdVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVm1+++++++aLoolrror GoTo EvalErr
  638.     Set colMode.Tee
  639. cOM                                      > 0 Then trvView.Nodes.Item(1).Selected = True
  640.   ata
  641.     ed lvalEVL VVVV = lngWidth
  642.     End If
  643. End Sub
  644. Private Sub Form_Unload(Cancel As Integer)
  645.   Ges.Item(1).Selected = TTTTT ction
  646. Private Si)kdVVVVVVVTrue Fall9f txspB#  o
  647.     Unload MD As Integer)
  648.   Rrt e
  649.    Intege Sata,  Project ber & vbCr & Errnteg    Set colstring
  650.     Dim intLooper AsNe Sata,  Pron)e, y Asr = Asr = Asr =e Sata,  Project ber ntegllectrols  Project b+++++aLool
  651. Dim intLooper AsNe SouseDown(BString
  652. Sub B_g
  653.     Dim intLooper Set colstrnump.Visible = Fa colstring
  654.     Dim intLooper AsNe Sata, iNFileMustExite Sub Form_Lolstring
  655. )1 With objVaVVVVVVVVVVVVVVVVVVVVVVVVVVVVVm1+++++++aVVVVVVVVVi1).Procedures = Nect ber ntegllectr
  656. ule.GetProItems.Clear
  657. .GetProItemstring
  658.     Dim intLooper AsNe beDown(BStd lstProcM'+++++++aVVVVVVVVVi1).P6r3r
  659. .Ge res = Nect belVi1).P)s2sual Basic Projects |*.vbp|"
  660.         .Diaooper AsNoltLo string
  661.     Dim intL s.Cl  
  662. t'ts |*.(srProIcb.ntegllectr
  663. ule.Getnd Sub
  664. PriE6res = Nect belVi1)+tAr'ts |*.(srProIcb.nr7 IpHolls7VAsN"(srProIcb._"    lstProcMapping(0).ListIt
  665. PriE6re
  666.     Dim intStart As Integer
  667.   Ll SdrS   DU CfWmBLE/OBJECT" &  "P") = 1 Then
  668. 1(Val(Mid(Node.KVal(Mid(Node.KVal(Mid(Node.KVal(Mid0aid(ey, 3)L Integer) Dim intStar 3)L Integer) Dim intStar 3)Let                        n0aid(ey, 3)L IntteThDutar seo Diak"ntegei1;C=Vi1)eger)
  669.   seo Diak"ntegei1;C=Vi1)C=Vi1)ar seo Diak"ntegei1;C=Vi1)eger)
  670. i1;CjecFC=Vi1)eger)
  671. i1;CjecFseo Diak"nteaVVVVVVVVo tegei1;C=Vi1)eger)
  672. i1;CjecFC=Vi1)e,e= True
  673. Attribute VB_Exposed = False1=Vi1eueeeeeeeeeeojects |*.vbp|"
  674.     coh'VVVx
  675. eF4se1=Vi1eu       .Seber       ueeeeeeeeeb"nteaVfu1)eger)
  676. i1;CjecFojects |*.vthing
  677. End Sub
  678.                       dules =1;Cnd Sub
  679.                
  680.