home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx" Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" Begin VB.Form frmCodeCommenter BorderStyle = 3 'Fixed Dialog Caption = "Little Helper: Auto Insert Error Trapping and Commenting" ClientHeight = 9405 ClientLeft = 45 ClientTop = 330 ClientWidth = 7800 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Icon = "frmCodeCommenter.frx":0000 MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 9405 ScaleWidth = 7800 StartUpPosition = 3 'Windows Default Begin VB.Frame fraProgress Caption = "Progress" Height = 1530 Left = 210 TabIndex = 32 Top = 7515 Width = 7590 Begin MSComctlLib.ProgressBar prgProgress Height = 360 Left = 150 TabIndex = 34 Top = 630 Width = 6270 _ExtentX = 11060 _ExtentY = 635 _Version = 393216 Appearance = 1 Scrolling = 1 End Begin VB.CommandButton cmdCancel Caption = "&Cancel" Height = 330 Left = 6585 TabIndex = 33 TabStop = 0 'False Top = 630 Width = 855 End End Begin VB.Frame Frame2 Caption = "Valid Variables:" Height = 2430 Left = 5655 TabIndex = 31 Top = 600 Width = 2025 Begin VB.TextBox txtVariableTypes BackColor = &H8000000F& Enabled = 0 'False BeginProperty Font Name = "Times New Roman" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 2115 Left = 60 Locked = -1 'True MultiLine = -1 'True TabIndex = 26 Text = "frmCodeCommenter.frx":0442 Top = 210 Width = 1890 End End Begin VB.CheckBox chkComments Caption = "Add comme&nts to file" Height = 195 Left = 90 TabIndex = 1 Top = 630 Width = 1815 End Begin VB.CheckBox chkErrorHandling Caption = "Add error &handling to file" Height = 195 Left = 90 TabIndex = 12 Top = 4605 Width = 2145 End Begin VB.Frame fraAction Caption = "Action" Height = 1545 Left = 90 TabIndex = 30 Top = 7770 Width = 7590 Begin VB.ListBox lstFileTypes Enabled = 0 'False Height = 960 Left = 5340 Style = 1 'Checkbox TabIndex = 22 Top = 435 Width = 1170 End Begin VB.CheckBox chkBackup Caption = "Make bac&kup" Height = 375 Left = 6615 TabIndex = 23 Top = 195 Value = 1 'Checked Width = 840 End Begin VB.CommandButton cmdQuit Caption = "E&xit" Height = 330 Left = 6615 TabIndex = 25 Top = 1065 Width = 855 End Begin VB.CommandButton cmdGo Caption = "&Go" Height = 330 Left = 6615 TabIndex = 24 Top = 675 Width = 855 End Begin VB.TextBox txtApplyTo Height = 945 Left = 1515 TabIndex = 20 Top = 435 Width = 3750 End Begin VB.CommandButton cmdApplyToFile Caption = "Apply To F&ile" Height = 330 Left = 105 TabIndex = 18 Top = 930 Width = 1290 End Begin VB.CommandButton cmdApplyToFolder Caption = "Apply To F&older" Height = 330 Left = 105 TabIndex = 17 Top = 540 Width = 1290 End Begin VB.Label lblToFileTypes Caption = "To File &Types:" Height = 240 Left = 5325 TabIndex = 21 Top = 195 Width = 1335 End Begin VB.Label lblActionCaption Caption = "A&pply the selected items to the following:" Height = 210 Left = 1515 TabIndex = 19 Top = 195 Width = 3840 End End Begin MSComDlg.CommonDialog cdlgFile Left = 7365 Top = -60 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.Frame FraInstructions Caption = "Note:" Height = 480 Left = 90 TabIndex = 28 Top = 90 Width = 7590 Begin VB.Label Label1 Caption = "You may modify the templates below (use Ctl+Enter instead of Enter to insert a Carriage Return)" ForeColor = &H000000FF& Height = 210 Left = 180 TabIndex = 29 Top = 210 Width = 7050 End End Begin VB.Frame fraDescription Caption = "Description of proceed&ure:" Height = 1485 Left = 90 TabIndex = 8 Top = 3060 Width = 7590 Begin VB.CommandButton cmdSaveDescriptionTemplateToFile Cancel = -1 'True Caption = "Sa&ve As Default" Height = 330 Left = 1350 TabIndex = 11 Top = 1020 Width = 1410 End Begin VB.CommandButton cmdLoadDescriptionTemplateFromFile Caption = "Load &From File" Height = 330 Left = 105 TabIndex = 10 Top = 1020 Width = 1200 End Begin VB.TextBox txtDescription BeginProperty Font Name = "Courier New" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 705 Left = 105 MultiLine = -1 'True ScrollBars = 3 'Both TabIndex = 9 Text = "frmCodeCommenter.frx":04E9 Top = 270 Width = 7365 End End Begin VB.Frame fraErrorHandling Height = 3180 Left = 90 TabIndex = 27 Top = 4560 Width = 7590 Begin VB.CommandButton cmdSaveErrorTemplateToFile Caption = "Save As &Default" Height = 330 Left = 1380 TabIndex = 16 Top = 2745 Width = 1410 End Begin VB.CommandButton cmdLoadErrorTemplateFromFile Caption = "Load Fro&m File" Height = 330 Left = 120 TabIndex = 15 Top = 2745 Width = 1200 End Begin VB.TextBox txtErrorHandling BeginProperty Font Name = "Courier New" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 1740 Left = 105 MultiLine = -1 'True ScrollBars = 3 'Both TabIndex = 14 Text = "frmCodeCommenter.frx":051A Top = 945 Width = 7365 End Begin VB.TextBox txtErrorHandlingTop BeginProperty Font Name = "Courier New" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 105 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 13 Text = "frmCodeCommenter.frx":0821 Top = 300 Width = 7365 End End Begin VB.Frame fraComments Height = 2430 Left = 90 TabIndex = 0 Top = 600 Width = 5490 Begin VB.OptionButton optPlaceCommentsWhere Caption = "&After Declaration" Height = 195 Index = 1 Left = 3765 TabIndex = 3 Top = 30 Width = 1635 End Begin VB.OptionButton optPlaceCommentsWhere Caption = "&Before Declaration" Height = 195 Index = 0 Left = 2025 TabIndex = 2 Top = 30 Value = -1 'True Width = 1650 End Begin VB.CommandButton cmdSaveCommentTemplateToFile Caption = "&Save As Default" Height = 330 Left = 1335 TabIndex = 6 Top = 1980 Width = 1410 End Begin VB.CommandButton cmdLoadCommentTemplateFromFile Caption = "&Load From File" Height = 330 Left = 90 TabIndex = 5 Top = 1980 Width = 1200 End Begin VB.ComboBox cboLang BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 ItemData = "frmCodeCommenter.frx":0865 Left = 3570 List = "frmCodeCommenter.frx":0875 Style = 2 'Dropdown List TabIndex = 7 Top = 2010 Width = 1830 End Begin VB.TextBox txtComments BeginProperty Font Name = "Courier New" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 1650 Left = 105 MultiLine = -1 'True ScrollBars = 3 'Both TabIndex = 4 Text = "frmCodeCommenter.frx":089E Top = 270 Width = 5280 End End Attribute VB_Name = "frmCodeCommenter" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit '************************************************************************* ' Author : Charlie Kirkwood ' File : frmCodeCommenter.frm ' NOTE: : This program is based upon an seriously scaled-down ' program by a developer named Jean-Philippe Leconte. ' He created his program on 11 october 2000 03:48. '************************************************************************* ' History : 20001102 - added file system object to load info from text files ' - added a LOT of functionality and seriously modified the interface ' - allowed user to create stored error handling types ' - allowed user to select what files to apply the error trapping/commenting to ' - added progress meter ' - aw F-it... it's just a different program!!! *hehe* ' 20001210 - added functionality for moving deinstantiating of objects ' to the error handler if they are deinstantiated at the end ' of hte procedure (note: any deinstantiation calls that are ' not at the end of the procedure, will not be moved into the ' error handler ' - modified the program to use an array and write to a new file ' instead of the existing file. This was necessary to handle ' moving hte deinstantiation code. '************************************************************************* Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long Private Type BrowseInfo hWndOwner As Long pIDLRoot As Long pszDisplayName As Long lpszTitle As Long ulFlags As Long lpfnCallback As Long lParam As Long iImage As Long End Type Private Const BIF_RETURNONLYFSDIRS = 1 Private Const BIF_DONTGOBELOWDOMAIN = 2 Private Const MAX_PATH = 260 Private Const BACKUP_EXT = ".backup" Private Const PROCMODULENAME = "%m" Private Const PROCSCOPE = "%s" Private Const PROCTYPE = "%t" Private Const PROCNAME = "%n" Private Const PROCPARAM = "%p" Private Const PROCRETURN = "%r" Private Const PROCDESC = "%d" Private Const CurrentDateTime = "%x" Private Const PROCDEINSTANTIATION = "%c" Private Const LANG_FRA = "Fran Private Const LANG_ENG = "English" Private Const LANG_ESP = "Espa Private Const LANG_DEU = "Deutsch" Private vArrFileTypes As Variant Private vArrScopes As Variant Private vArrMids As Variant Private vArrProcedures As Variant Private vArrProcedureEnds As Variant Private vArrEnds As Variant Private vArrOnError As Variant Private lModProcedures As Long Private lProcedures As Long Private Enum eTemplate eTemplateComment eTemplateDescription eTemplateErrorTrapping End Enum Private Enum eAction eActionApplyToFolder = 0 eActionApplyToFile = 1 End Enum Private meAction As Long Private Const mcsActionCaption As String = "Apply the selected items to the following" Private Const mcsFile As String = " File:" Private Const mcsFolder As String = " Folder:" Private Const mcsNoFileSelected As String = "No file was selected, do you want to use the default template?" Private Const mcsDefaultTemplateDescription As String = "_DescriptionTemplate.lht" Private Const mcsDefaultTemplateComment As String = "_CommentTemplate.lht" Private Const mcsDefaultTemplateErrorHandling As String = "_ErrorHandlingTemplate.lht" Private Const mcsFilterForAllVBFiles As String = "All files (*.*)|*.*|Forms (*.frm)|*.frm|Modules (*.bas)|*.bas|Classes (*.cls)|*.cls|User controls (*.ctl)|*.ctl" Private Const mcsFilterForTemplateFiles As String = "Little Helper Template Files (*.lht)|*.lht" Private Const mcsProcTypePropLet As String = "Property Let" Private Const mcsProcTypePropGet As String = "Property Get" Private Const mcsProcTypePropSet As String = "Property Set" Private Const mcsProperty As String = "Property" Private Const mcsLineContinuationChar As String = "_" Private Const mcsModuleNameIdentifier As String = "Attribute VB_Name = """ Private Enum eCommonDialogConst ecdlShowOpen = 1 ecdlShowSave = 2 ecdlShowColor = 3 ecdlShowFont = 4 ecdlShowPrinter = 5 ecdlShowWinHelp32 = 6 End Enum Dim moHourglass As clsHourglass Dim fCancelProcessing As Boolean Private Const mclOffScreen As Long = -20000 Private Const mcsExitStatement As String = "Exit " Private Const mcsDeinstantiateStatement As String = "Set * = Nothing" Private Const mclCommentsBeforeDeclaration As Long = 0 Private Const mclCommentsAfterDeclaration As Long = 1 Private Const mcsDefaultTab As String = " " '__________________________________________________ ' Scope : Private ' Type : Sub ' Name : chkComments_Click ' Params : ' Returns: Nothing ' Desc : The Sub uses parameters for chkComments_Click and returns Nothing. '__________________________________________________ ' History ' CDK: 20010102: Added Error Trapping & Comments '__________________________________________________ Private Sub chkComments_Click() On Error GoTo Proc_Err Const csProcName As String = "chkComments_Click" Me.fraComments.Enabled = Me.chkComments Proc_Exit: GoSub Proc_Cleanup Exit Sub Proc_Cleanup: On Error Resume Next 'Place any cleanup of instantiated objects here On Error GoTo 0 Return Proc_Err: Dim lErrNum As String, sErrSource As String, sErrDesc As String lErrNum = VBA.Err.Number sErrSource = VBA.Err.Source & vbCrLf & "frmCodeCommenter->" & csProcName sErrDesc = VBA.Err.Description Resume Proc_Err_Continue Resume Proc_Err_Continue: GoSub Proc_Cleanup MsgBox "The following Error Occurred" & vbCrLf & vbCrLf & _ "Source:rror OccurredEE Begin VB.ComboBox cboLang rsFolle CaptioC As String = "No file was selected, do you want to use the default template?" Private Const mcsDefaultTemplateDescription As String = "_Descr-r_Continue Resume2n As String = "_DeszNONLYFAx . = ded progress meter ' - aw F-it... it's tion As Long = 0 Private Const mclCommentsAfterDeclaration As Long = 1 9nfsent tStae.. it's tion As Lon_G17ivaiN "&After Declaration"n&G17ivaiN "&AO1) Top V5280 End Enderor Res9 l9FB}#1.2#0"; "comdlg32.ocxoTd4d = "%x" Private Const PROCDEINST - = "%-" Pr-rivatt N ""&AO1) Top:LYFAx . = ded progreslboB= Private Private 26ytefoncti "%n___p 'MvatiMdthkC "&AO1) To5to ing = " Folder:" Private Const mcsNoFileSelected As String = "No file waabIndex = 19 t template?" PlNAME = "%m" Private Const PROCSCOPE = "%s" Private Const PROCTYPE = "%Privtring = "No filAGtLong = *rivate Const mcsNoFifilAGt'ecng Private Cefile yAg32.ocxoTd4d = "%x" Private CoBiTe Const mcsNoFifil=TlMiooe"%n___p 'MvatiMdth e'0ateon Av,sNoFi8nteon Av,sNoFi8nteo 3 Wong = -20000 PrT7***0bno uses paramete Prmn_G1aterneContTnt As String =2d & vbCrLf & vbCrLf & _ dApplyToFile Caption = "Ap PrT7***0bno uses paramPrixfo11Labion As l4s String =2d & vbCrLf (Iorleanup: iTe= 3 0 LT On .st a differe 0 LVeE = 30 V _ dApplyToFile Caption = "Ap ft = ' CDK: 2001oad &From FiF 0 t.mFnF 0 t.mFnF 0 0 t.mFnF 0 t.mFnFoper4eihTemplai Return Proc_iDt.mFnF 0 t.mFnFoper4eihTemplai Return Proc_5pter4eihTemplai orn Top stae0. "%m" ,elmentsAfterDeclarant As a9c8Err_Continue: 1 Const csProcName CoBhonst st01oad &Frw nrT7**cP8vate Const mpAGt'ecng Pro0 t.mFnFoper4eihTemOlntinue:Error arant As a9c8mFnFoper4eihTem|1Error arant As a9c8mFnoperdtefoncti "%nN = "N As aror arant As a9c8mFndtefoncti "%nN = "N As aror arant As a9c8mFndtefoncti "%nN = "N As aror "%nN onc Long = -20000 Pr PROCDEate CoBiTe ComiaWae CoBiTe Cong uh0"N As aroiNoFiaeW Sy to handle ' y to handle ' y to handle ' o hasGA800 Underline = 0 'False ItalisFoper4eihTem|1Error arant As a900 Underline = 0 'False ItalisFoper4eihTem|1E: : This program is based upo = ded 4eihTem|1E: : This program is based upo = ded 4eihTem|1E: : This program is based upo = ded 4eihTem|1E: : This program is based upo = ded 4eihTem|1E: : This prograse8: : This protine = 0 'False AoperffScre "No ficc Asis prograse8: : This protine = 0 'False AoperffScre "No fl use 4eihTememplatF"No fl use 4eihTememplatF"No fl use 4eihTememplatF"No fl use 4eihTememplatF"No fl use 4eihTememplatF"No fl usco fro5ihTemempla1"frmCiried u8t Private meAct+rPO0 Underline = 0 'False ItalisFoper4eihTem1oad &Frw P ItalisFoper4eihTemnProYFP : This protine = 0 'False u Enu_s VarimeAction As Long Private Const mcsActionCaption As String = "Apply the selecN "&Af-ai ae8emn- a Pr imeIdentifier A"ynt PROCSCOA8ry ' CDK: 20010102: A.2"e sese Caption = "&Save As Default" Height = 330 Left . p . p. p e 1 Privateeror Res9 . p. p e 1 Privateeror Res9 . p. p i8nteo 3 Wong = -20000 Pe = "&Load t?x 1 PruPByName As Long lpszTitle As Long ulFlags As Long lpfnCallback As LCallback AO