PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[vb6] Project Scanner-VBForums
Page 1 of 6 1234 ... LastLast
Results 1 to 40 of 214

Thread: [vb6] Project Scanner

  1. #1

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    [vb6] Project Scanner

    DISCLAIMER 9 Jan 2019: The project included in the zip at bottom of this post is under revision. The last 3 pages of posts in this thread discuss ways of improving speed & accuracy. I have decided on a course of action that will require significant rewrites of many procedures. This project will be updated later this month with those changes.

    Might be useful to some to help clean up their code before they post it out to the world? A project that started with an experiment in parsing VB files, but evolved to what we have here.

    This project has two parts

    1) Scan any VB6 project and quickly display a summary of declarations, procedures, controls used, and more. This can be used for a quick review of your own projects or those you download from sites like this one.

    2) A deeper analysis of the code content within a project. It currently offers 10 validation checks. These checks can help tidy up your code and maybe even pinpoint a problem or two. Here is a brief description of the various scans.

    - Code files (forms, classes, etc) that do not use Option Explicit
    - Procedures with no executable code
    - Procedures that contain active End or Stop statements
    - Zombie declarations and procedures. Items that are created/declared but not referenced within your code
    - VarType checks. Items not declared with a variable type and default to Variant
    - API checks that help identify those that use uncommon parameter vartypes
    - Strings that are duplicated within your code. These can be consolidated to constants
    - Declarations that are duplicated
    - Variant functions used in place of string functions, i.e., Trim() vs. Trim$()
    - OPC (other people's code) checks to highlight code that could potentially be used to modify your registry. Also, shows you what, within your code, would be flagged if someone used this tool to scan your project.

    Many of the checks could produce false positives. So, consider these checks as informational only. The help menu in the project offers more details on these checks along with known false positives. One thing this project does not do is to look for undeclared variables. Adding Option Explicit statements to your code files will help you in that case. One thing Option Explicit can't help with that this project can, is the dreaded dead declaration that results in a typo with the ReDim statement. Following code creates 2 declared & arrayed variables. In this example, the second one (highlighted in blue) is a typo, but valid. Chances are that one of these would not be used within the routine, due to the typo. In that case, one of them would be reported as a zombie declaration.
    Code:
    Dim TempVal() As Long
    ReDim TmpVal(25) As Long ' << letter e missing in variable name
    The project allows you to save scans as a recordset that can be reloaded/reviewed at another time. It also allows exporting results to an XML format.

    Name:  ScrnShot.png
Views: 1696
Size:  26.8 KB

    Code:
    Major Changes
    X-mas 2018: Attempt to make DBCS-compatible for non-US versions of VB
    Attached Files Attached Files
    Last edited by LaVolpe; Jan 9th, 2019 at 07:44 PM. Reason: oops, left in some test code. re-uploaded
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  2. #2

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    I will use this section to explain items in more detail or offer tips/tricks that can be used with this project

    1. Clarification. I use the word "items" in code comments quite often. An item is anything that is declared within a code file, the code file itself, or any external references associated with the project. See the public enumeration ItemTypeConstants in modMain for a listing. See clsRecords.AppendItem for details on what information is collected for each of those items.

    2. Tip. Right click on the treeview listing to display the "Navigation" menu

    3. Tip. When you perform a validation check, you can remove validation items from the treeview. If you save the validation to XML, you could remove items you don't want to address or false positives. Then use the XML at a later time to identify items you want to fix within your code. Any removed items from the treeview are not persisted otherwise. XML files cannot be used as a source to reload its content into the project. But any saved scans can be.

    4. FYI. Compiler directives, i.e, #If, #ElseIf and #Else statements are processed in the code via the Scripting Control. Any code that exists in one of those blocks where the block tested false is not processed (skipped) by this project. If using the navigation menu and displaying declarations/procedures, the compiler directives and any "skipped" code are not displayed. You could review those directives by displaying the entire code file or opening the project in the IDE.
    Last edited by LaVolpe; Nov 25th, 2018 at 03:55 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    WOW Keith ... it's GREAT to see you back. I'm guessing you took a hiatus to write this code and to just take a breather from things. This project looks SUPER interesting.

    Welcome Back!,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  4. #4
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    A suggestion if you don't mind ... some kind of label that reports what it's doing when it's opening/scanning the project (maybe similar to the way the validation does). My main project takes several minutes to open, and I just start wondering if it's hung. Just something to let me know it's not would be super.

    Take Care,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  5. #5
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,720

    Re: [vb6] Project Scanner

    Typelib versions are in hex (e.g. "a.0" is a version) in pvAddReference had to tweak this
    thinBasic Code:
    1. ' Ln 1504
    2.         iMajor = CInt("&H" & Left$(sParams(1), lValue - 1))
    3.         iMinor = (CInt("&H" & Mid$(sParams(1), lValue + 1)))
    When typelib is missing bombs in frmMain w/ invalid use of null (field constFldAttr2 is null)
    thinBasic Code:
    1. ' Ln 881
    2.                     tvItems(0).Nodes.Add .Index, tvwChild, , rsLocal.Fields(constFldAttr2).Value
    Constants can be used as default values to optional params like this (misses LOCALE_USER_DEFAULT usage)
    thinBasic Code:
    1. Private Function pvGetUserLocaleInfo(ByVal dwLCType As Long, Optional ByVal LocaleID As Long = LOCALE_USER_DEFAULT) As String
    Named params seem to not be parsed (misses sCriteria usage)
    thinBasic Code:
    1. If DispInvoke(rs, "Find", Args:=sCriteria) Then
    Module public properties assigned with module prefix(misses property let ErrClientName usage)
    thinBasic Code:
    1. mdApp.ErrClientName = "test"

    This turned out to be a super useful linter! I've been using MZ-Tools Review Code feature but it misses lots of checks.

    Probably this is on par with aivosto's Project Analyzer functionality-wise.

    cheers,
    </wqw>

  6. #6

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    wqweto, I'll look into those & thanks for the examples.
    Edited: Regarding the module property being missed? If that's a standard (bas) module, then that's on me. If it's a public property in a non-standard module (class, form, uc, etc), then public properties aren't tested for zombie state; explained in the documentation. Based on the prefix you gave in your example, that looks like it may be a standard module. In either case, will re-examine the logic I used.

    Elroy, I'll look at a popup form to display some sort of status. There is feedback while the parsing is happening, but I'm assuming you are talking about the delay from when that finishes and the treeview is ultimately populated & displayed. I can see that being an issue for very large projects: dozens upon dozens of code files containing potentially 100s of procedures overall, and even more so when validation finishes, if there are 1000's of validation entries. The largest project I tested was about 50K statements; which was really a group project of many projects.
    Last edited by LaVolpe; Nov 26th, 2018 at 07:04 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,720

    Re: [vb6] Project Scanner

    Yes, mdApp in sample above is a standard .bas module.

    Also, just hit a limitation of the tree-view control -- 32k nodes but the project I'm scanning has more than 100k rows in rsItems. Had to guard each tvItems(0).Nodes.Add w/ If tvItems(0).Nodes.Count >= 0 Then as on overflow Count becomes -32768 (negative:-))

    cheers,
    </wqw>

  8. #8

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    :: the tree-view control -- 32k. I'll have to rework some things similar to "paging" for such heavy results. Maybe delay loading branches, removing collapsed branch's child nodes for example. I can't imagine the item listing treeview could reach that limit. But I could see where the validation listing treeview could.

    In the mean time, may just look at a quick fix and use some sort of "rule of thumb" for displaying portions of validation results. There is no hard & fast ratio of recordset rows to treeview nodes, but I think I can figure out a good guesstimate. For example, a single parsed item, say a Dim statement, could generate several nodes in the validation listing because the variable in that statement could fail multiple checks, i.e., vartype and zombie checks. In that treeview, displaying the validation also results in including additional nodes for headers and grouping. I honestly didn't plan on any collections of +100K records and +32K nodes.
    Last edited by LaVolpe; Nov 26th, 2018 at 07:34 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  9. #9
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    There is feedback while the parsing is happening, but I'm assuming you are talking about the delay from when that finishes and the treeview is ultimately populated & displayed. I can see that being an issue for very large projects: dozens upon dozens of code files containing potentially 100s of procedures overall, and even more so when validation finishes, if there are 1000's of validation entries. The largest project I tested was about 50K statements; which was really a group project of many projects.
    Hi LaVolpe,

    Yes, my primary project has a VBG as well, but I seldom use it as the DLLs are quite stable and seldom re-compiled. However, here's what happens when I load the primary VBP with your program: 1) it loads the modules fairly quickly, then 2) there's a long pause while it's somewhat hung on that completed list, and then 3) that list is cleared after which another long pause occurs. I didn't study your source to see exactly what's happening in those two pauses, but I suppose that's where I'm thinking some feedback would be nice. If it just happened directly in the TreeView, that would be fine, or a "popup" would be fine.

    Here's my primary project (the VBP of the main piece):

    Name:  Validator.png
Views: 1454
Size:  16.7 KB


    Again, THANKS! for the magnificent work. I was rather amazed at how many occurrences of default dimensioned (i.e., Variant) variables I had. Those are all fixed now.

    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  10. #10

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    Quote Originally Posted by Elroy View Post
    I didn't study your source to see exactly what's happening in those two pauses, but I suppose that's where I'm thinking some feedback would be nice. If it just happened directly in the TreeView, that would be fine, or a "popup" would be fine.

    Again, THANKS! for the magnificent work. I was rather amazed at how many occurrences of default dimensioned (i.e., Variant) variables I had. Those are all fixed now.

    Elroy
    At least one of those pauses I have no control over. The treeview, using common ctrls v5, seems to have a delay between me adding the last node and ultimate display of the nodes. Short of subclassing to try to figure out what's going on inside the control at that time, thinking a self-closing pop-up to show which code files are being processed (added to the tree), then a final indication that the treeview is preparing to show the results. Adding the state to the treeview itself would only make the issue worse I think.

    Regarding the variants -- me too. I ran this on several of my projects. Found a few functions, and some properties, where I forgot to include the return vartype. Typically, I think those are cases where we convert a Sub to a Function & forget to finish it off completely. In one of my projects, the ReDim zombie (noted in 1st posting above) was found; that was unexpected. Of all the ones I tested, I only found one variable where I forgot to declare the type -- patting myself on the back

    Edited: 502 code files for one project - wow, that's a biggie
    Last edited by LaVolpe; Nov 26th, 2018 at 08:52 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  11. #11
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,720

    Re: [vb6] Project Scanner

    DefObj A-Z for the win. . . Zero untyped vars/functions :-)) Though I found out couple of (small) modules w/ no DefObj A-Z

    I also have a policy for zero warnings by the MZ-Tools linter so no unused private consts/vars/routines/types but LaVolpe's linter detects dead *public* functions too which took me most of today to clean up.

    cheers,
    </wqw>

  12. #12
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    At least one of those pauses I have no control over. The treeview, using common ctrls v5, seems to have a delay between me adding the last node and ultimate display of the nodes. Short of subclassing to try to figure out what's going on inside the control at that time, thinking a self-closing pop-up to show which code files are being processed (added to the tree), then a final indication that the treeview is preparing to show the results.
    Hey, if you do it as a popup, maybe feedback on what you can, and just a message something like "Loading TreeView, there may be a pause between loading last node and final loading ... please wait." or some such. I wouldn't do any subclassing just for that.

    Quote Originally Posted by LaVolpe View Post
    Typically, I think those are cases where we convert a Sub to a Function & forget to finish it off completely.
    Yeah, I had about a dozen of those. I think mine were about 50/50 what you're saying, with the other 50% being the opposite. I found several cases where I had a Function with no type declaration, but also no return value set. I checked the calls, and, in all cases, they were called like a Sub, so I just changed them. Who knows why I did that.

    I was rather proud of myself for not having any naked Redims. I often mistakenly code those. However, the way I tend to code, they typically self-correct themselves with runtime errors during alpha-testing. They only one I found was in your latest Common Dialog Class, which I'm using for one case. Actually, the Redim'med variable wasn't being used, so I just deleted the line of code.

    It's truly FANTASTIC to have you back! I was actually worried about you.

    I'd still like to know if Bonnie West is okay. She just dropped out without a peep, and I think she'd get a smile out of some of the recent Collections work that's happened.

    Best Regards,
    Elroy

    EDIT1:

    Quote Originally Posted by LaVolpe View Post
    Edited: 502 code files for one project - wow, that's a biggie
    Yeah, that's why I sort of cringe when I ask a question about something and somebody says, "Well, why don't you just add another form to get that done?" In many cases, I'm using "general purpose" forms to get various things done. For instance, I let the users maintain, I'd say, at least 50 lists of things in a maintenance area (physicians, procedures, prosthetics, orthoses, forefoot deformities, hindfoot deformities, etc, etc, etc), and in well over half of these, it's a common form that pops up to maintain these lists.
    Last edited by Elroy; Nov 26th, 2018 at 09:43 AM.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  13. #13
    Fanatic Member
    Join Date
    Dec 2012
    Posts
    810

    Re: [vb6] Project Scanner

    Excellent program! I often cobble together parts of programs to make other programs, and often end up with unused and unreferenced code that takes a long time to clean up. This will help a lot.

    J.A. Coutts

  14. #14
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    This thing is truly great!

    Just a list of a couple of "niceties" I wouldn't mind seeing:

    • A "recently used file" list under the "File" option on the menu.
    • If opening the entire module (Show Entire Code File), have an option to actually edit and save modules from this Scanner program. I know this'd be a bit dangerous, but it'd still be nice.
    • From the TreeView, have a "Copy" option on the context menu. I find I have my project open in the IDE, but I have to search for the procedure and/or variable I'm wanting to fix. I have to re-type it to do the search. A right-click/copy of just the procedure name or variable name would be quite nice for bouncing back and forth.
    • In addition to the XML export, have an indented ASCII export of the Validation List.

    Obviously, all just ideas, but things I thought about.

    Best Regards,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  15. #15

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    Elroy, thinking about your "nice to haves"

    - CSV: not sure that'll be doable. CSV's are not friendly to hierarchical data. There is no consistency how each header's branch structure is defined. Nothing there where I can say that the CSV will always have fields A, B, C etc. Some of the nodes are dependent on nodes created before them, dynamically assigned. I chose XML because it does support hierarchy easily and it's easy to view in any web browser and other apps like Notepad++

    - MRU listing would need to be cached to file or registry. I'm not a big fan of writing to the registry; though a config file of sorts could be a consideration. Will think about that.

    - Regarding the display of the file and or procedures/declarations section, etc... Plan on doing away with that viewer I've included in the project. I'd prefer to send the info to NotePad/WordPad which would enable the user to do whatever they want with the text/data, including find and search & replace support, saving, etc. I'm not going to add anything that would update a project's code file. But the NotePad/WordPad option would give the user choices.

    For today and next couple of days -- focusing on the 'bug' report wqw gave us.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  16. #16
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    For today and next couple of days -- focusing on the 'bug' report wqw gave us.
    No problem at all. I guess my biggest issue for me was bouncing back and forth between the Project Scanner and my project loaded into the IDE, and being able to quickly get to the areas in my project within the IDE that need work. On my first big "fix", I exported the TreeView to XML, edited all the XML tags out of it, and then used that file as a ToDo list for my project. That also gave me copy-paste capabilities for searching my project in the IDE (using the saved edited XML file). It also saved a record of my work and how much was done so that I didn't have to Re-Validate the project when I started working on it again (such as I did last night and then this morning).

    On a slightly different note, opening modules in Notepad or Wordpad would be super. Preferably, you'd let the user decide the editor, as NP++ is my preferred ANSI/Unicode editor.

    Best of luck with it, and it seems to be working perfectly on my projects. Apparently I don't use the situations outlined by Wqweto. I'm not sure why but that "Named Argument" syntax for calling a procedure has always driven me a bit nuts.

    Take Care,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  17. #17

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    The biggest annoyance I have at this time is the treeview delay between last node added and when it shows all the nodes. Even subclassing the treeview via Spy++, nothing unique is sent when the treeview finally repaints. So, at this point in the game, I have no way of knowing when the treeview will respond to mouse input after I've finished appending nodes. I implemented a popup form to show progress while parsing and while populating the treeview, but it closes (the load project routine finishes) several seconds before the treeview becomes responsive. For large projects that could be more significant than just a few seconds. And I'm no where close to adding a project with 500 code files. In my example it was about 100 (group with 6 projects) and the delay felt like 10 seconds. SendMessageTimeOut might be an answer to knowing when it becomes responsive, but the other issue of the 32K node limit still applies.

    Gotta start wondering whether the treeview is the best control for displaying these results; don't want to use the MS hierarchical flex grid -- ugly. Probably gonna look at delay loading nodes when they are expanded. That will speed things up quite a bit. However, that in itself lends to other issues, i.e., the XML report expects all nodes to be there. Delay loading guarantees they won't be. Probably take a day to brain dump and come at it from a different angle. One idea is to create the nodes in a recordset and then simply upload them to the treeview on demand. All the nodes will be created, but exist outside the treeview. I'd think this might be a speed bump, but offers a positive side effect -- we could remove items from the validations & persist them, so that if the results are saved as a recordset and reloaded, the "hidden/removed" items will remain hidden. That could be a nice way of knowing where one left off when using the list to fix their project. Just thinking out loud.

    Regarding the bugs that wqw provided, all but one are already fixed. The named params issue ended up being just 2 additional IF statements since I was already looking for them - just forgot to include them in the pvProcessWords routine.
    Last edited by LaVolpe; Nov 26th, 2018 at 08:04 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  18. #18
    Frenzied Member
    Join Date
    Sep 2012
    Posts
    1,834

    Re: [vb6] Project Scanner

    Very nice. It's great to see you come back.

  19. #19
    Hyperactive Member
    Join Date
    Jan 2015
    Posts
    330

    Re: [vb6] Project Scanner

    I am trying it on one of my projects (quite big).
    After 10 min, I had to kill VB6

    Also, I had invalid use of null here
    Private Sub pvLstAdd_References(rs As ADODB.Recordset, pNode As Node)
    tvItems(0).Nodes.Add .Index, tvwChild, , rsLocal.Fields(constFldAttr2).Value

    and I had to do this continue
    tvItems(0).Nodes.Add .Index, tvwChild, , rsLocal.Fields(constFldAttr2).Value & ""


    Otherwise, VBIDEUtils also is doing similar analysis.
    You can grab sources on github

  20. #20
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    Here's another one I'd sure like to see included in the validation:

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
        ReDim abc(1 To 5) As Long
        Debug.Print abc(1)
    End Sub
    

    That code validates just fine, but I personally don't think it should:

    Name:  Valid2.png
Views: 1405
Size:  11.2 KB

    In fact, when you right-click the abc variable and then click "Definition" in the IDE, you get the following:

    Name:  VarAbc.png
Views: 1398
Size:  4.5 KB

    So, in a sense, not even the IDE thinks it's very good code, but it will compile and run. Personally, I think it's a "leak" or "circumvention" of Option Explicit.

    Personally, I just don't think a Redim should ever be used on variables that aren't previously declared.

    Best Regards,
    Elroy
    Last edited by Elroy; Nov 27th, 2018 at 06:28 AM.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  21. #21

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    Quote Originally Posted by Thierry69 View Post
    Also, I had invalid use of null here
    Private Sub pvLstAdd_References(rs As ADODB.Recordset, pNode As Node)
    tvItems(0).Nodes.Add .Index, tvwChild, , rsLocal.Fields(constFldAttr2).Value
    Yepper, already reported earlier. The preferred fix is to test for Null and not create the sub-node that follows. As for the lengthy delays for "quite big" projects, working on that.

    Quote Originally Posted by Elroy View Post

    Personally, I just don't think a Redim should ever be used on variables that aren't previously declared.

    Elroy
    I will consider flagging it for FYI. Though it is 100% legitimate and even some promote its use as faster than the alternative: Dim a() then ReDim a(5).

    FYI: If you look at this short example, the ExitRoutine label gets the same message.
    Code:
    Public Sub Tester()
    
        MsgBox "Hello World"
        
    ExitRoutine:
        
    End Sub
    Last edited by LaVolpe; Nov 27th, 2018 at 06:34 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  22. #22
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    RE: My ReDim check outlined in post #20:

    Just as any FYI for you, I'm pretty good-to-go. It's my habit to never explicitly declare the vartype when I use Redim. Therefore, when I "Validate", it catches them in the "VarType Check" section if/when they're not previously declared.

    But that also tells me that, when you see a ReDim, you're jumping through some hoops to see if it's been previously declared. So, it would seem that you're pretty close to doing that check anyway.

    Take Care,
    Elroy


    EDIT1: Just more praise, LaVolpe. I'm truly excited about your project. In a very real sense, it feels like the Microsoft VB6 project is finally being completed. Most (if not all) of this stuff should have been included in the IDE, imho. I could easily see this expanded to start looking for some of the known compiler bugs. The one that immediately comes to mind is the UDT array bug, where the UDT-vartype received by a procedure is NOT validated against the UDT-vartype sent by the caller. Another is where trying to negate a UDT causes major problems. Yet another is where, under certain circumstances, assigning dynamic arrays (of any type) can bring down the IDE (as outlined here). Not saying these should be immediately included in this validation project. Just suggesting that they could.

    Oh, and hey, as a fun poke at your "Though it is 100% legitimate..." comment, so is not using Option Explicit or just letting variables default to Variant. But, yeah, I suppose I do get the point that some say a naked ReDim is faster. It's just not to my liking.
    Last edited by Elroy; Nov 27th, 2018 at 07:05 AM.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  23. #23

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    Yes, it is known whether the ReDim is applied to a previously declared variable when procedures are parsed. Flagging it as a separate validation check is just a matter of creating a separate validation flag, i.e., vnReDimNoDim, & applying that flag at that time. The vartype check is performed in the routine that tests ReDims during procedures parsing. The zombie check is performed after the procedure is parsed. That specific case could trigger 3 different validation failures: vnZombieChk Or vnVarTypeChk Or vnReDimNoDim

    Quote Originally Posted by Elroy
    But, yeah, I suppose I do get the point that some say a naked ReDim is faster. It's just not to my liking.
    Nor mine. If it occurs in any code I write, it is unintentional and likely an error in waiting
    Last edited by LaVolpe; Nov 27th, 2018 at 07:13 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  24. #24
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    Ok, I found a bug.

    Here's the little Form1 test code I'm using:

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
        Dim s As String
        s = Left(s, 2)
    End Sub
    
    

    Now, if I validate for nothing but "Identify functions used as Variant vs. String", it doesn't find that Left(s) function...

    Name:  Val1.png
Views: 1395
Size:  13.9 KBName:  Val2.png
Views: 1378
Size:  8.8 KB

    However, if I also check the "Identify zombie items", it works just fine:

    Name:  Val3.png
Views: 1393
Size:  13.8 KBName:  Val4.png
Views: 1372
Size:  10.2 KB

    Take Care,
    Elroy

    EDIT1: It seems that a great deal "pivots" off the zombie scan, and that probably (internally) that one needs to be mandatory. But I'm almost certainly telling you things that you already well know. I was just staring at it a bit.
    Last edited by Elroy; Nov 27th, 2018 at 11:00 AM.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  25. #25
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    369

    Re: [vb6] Project Scanner

    getting error -2147221231 from CoCreateInstance in pvInitStructure when trying to open a project.

  26. #26

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    Quote Originally Posted by DllHell View Post
    getting error -2147221231 from CoCreateInstance in pvInitStructure when trying to open a project.
    That's from the browser class. Can you tell me what O/S you are running? If it isn't something simple, may ask you to bump your question over to the thread related to that class...
    http://www.vbforums.com/showthread.p...t-Another-One)
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  27. #27

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    At Elroy; thanx for the bug report. I'll have to look at some of the filters I created. Didn't want to perform unnecessary checks based off of the options form. I probably have a conflict where I only compared for zombie checks vs zombie + combination of other options. Easy enough patch - thanx.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  28. #28
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    369

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    That's from the browser class. Can you tell me what O/S you are running? If it isn't something simple, may ask you to bump your question over to the thread related to that class...
    http://www.vbforums.com/showthread.p...t-Another-One)
    win7 (6.1.7601)

  29. #29

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    Quote Originally Posted by DllHell View Post
    win7 (6.1.7601)
    Do you have themes turned off? I found some posts that describe that exact error on Win7 when themes are off. If that is the case, if you look in the CmDialogEx class Initialize event, you'll see a comment regarding faking pre-vista. Un-rem that comment and the problem will go away, but you will be using pre-Vista dialog.

    Quote Originally Posted by Lex Li
    It seems that if Visual Themes feature is turned off for whatever reason, Windows would hide the COM interface and lead to the crash. However, this answer does not provide any specific workaround.
    Edited. Another possibility is the usage of the SetThemeAppProperties API. If it is called without passing the STAP_ALLOW_CONTROLS flag, it could cause the same error you are seeing, per some threads on StackOverflow

    If any of these apply to your situation, please let me know so I can update the thread related to that browser class and also update this project. Thank you.
    Last edited by LaVolpe; Nov 28th, 2018 at 06:59 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  30. #30
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    369

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    Do you have themes turned off? I found some posts that describe that exact error on Win7 when themes are off. If that is the case, if you look in the CmDialogEx class Initialize event, you'll see a comment regarding faking pre-vista. Un-rem that comment and the problem will go away, but you will be using pre-Vista dialog.
    Themes have not been turned off but adding that line to the init did fix it.

  31. #31
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,562

    Re: [vb6] Project Scanner

    Hi LaVolpe,

    I'm looking forwarding to trying out your tool, but unfortunately I've been unable to open my projects - the Project Scanner just crashes completely (taking down the IDE without warning) after trying to open them. I had some spare time to step through the code to see if I could find the error, and what I've found is that the pvAddReference function is getting an unhandled Type Mismatch error at the following line:

    Code:
    iMajor = CInt(Left$(sParams(1), lValue - 1))
    An example problematic sRef parameter value is:

    Code:
    {B53264D5-3EF2-4C25-AD09-EAC54E74AD4F}#1fe.1#0#..\..\..\bin\common\SL5ImageFactory.dll#FIVE Image Processing Library
    You'll notice that the version is quite high and is represented in hex, which explains the type mismatch error.

    I don't know if version numbers are always represented in hex in VBP files, or if they change to hex once they reach a certain value, but this will need to be accounted for. I think it would also be ideal if the error was trapped so it didn't nuke the whole program.

    If version numbers are always in hex, then the fix should be easy:

    Code:
    iMajor = CInt("&H" & Left$(sParams(1), lValue - 1))
    If version numbers only become hex after a certain value, then you'd have to perform a test I guess...not sure if the VBP file format is documented anywhere?

    %

  32. #32
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    WOW, that is a large version number. He's also got to worry about the sub-version.

    I did a Google search for: "Reference" "vbp" "Form" "Module" "MaxNumberOfThreads" (with the quotes, looking for posted VBP files).

    It was difficult to find references with versions over 9, and I looked at at least 20 or 30 VBP files. Eventually I did find this one. It was particularly interesting because it appeared to have a hex sub-version:

    Code:
    Reference=*\G{0E3B7611-7892-11D2-84D9-0040C71340BC}#7.a#0#..\..\..\..\..\WINDOWS\system32\Trax.dll#

    I'm starting to think that they're just all hex, and we've seldom seen it because we never go over 9.
    Last edited by Elroy; Nov 28th, 2018 at 11:31 AM.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  33. #33

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    @jbpro. wqweto mentioned that in post #5. I've fixed it on my end, but haven't uploaded the update since I'm still working on the delay issue.

    FYI: All parts of the TLB version and LCID are hex. They are also hex in the registry. The patched pvAddReference routine will convert the hex to decimal before it is added to the recordset. When the main form displays the references in the treeview, no hex conversion needed because it is getting the value from the recordset.

    @Elroy. It is possible to find 409 in the references as the final part of the VB reference string: 409 is hex for 1033 (US English LCID). When I first designed this thing, I knew LCIDs could be hex, but didn't know that the versions were, for the same reason... didn't see any examples using a-f in the version tokens.

    @DllHell: "Themes have not been turned off but adding that line to the init did fix it."
    Still would love to know why CoCreateInstance isn't working for you when trying to initialize a file dialog. If I knew for sure I could modify the dialog/browser class to check and fix the problem. In the mean time, I'll tweak the code to test for an error and revert to pre-Vista if it errors.
    Last edited by LaVolpe; Nov 28th, 2018 at 12:01 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  34. #34
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,562

    Re: [vb6] Project Scanner

    Ahh, missed that one. Sorry for the noise and thanks for clarification re: the TLB version & LCID.

  35. #35
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    369

    Re: [vb6] Project Scanner

    getting a "subscript out of range" error when scanning this line of code:

    Code:
    If TypeOf .Controls(t) Is Frame Then

  36. #36
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,984

    Re: [vb6] Project Scanner

    I checked, and it is throwing an error. Here's a complete piece of code that will produce the error. I just threw a single Frame on the Form1:

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
        With Me
            If TypeOf .Controls(0) Is Frame Then
                Debug.Print "Found frame"
            End If
        End With
    End Sub
    
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  37. #37

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,597

    Re: [vb6] Project Scanner

    Thanx for that bug report. The logic failed to expect "Me" by itself, my bad. As a quick fix, you can make these small changes in pvParseWordList with clsZombie

    1. Find the lines in red and replace with the ones in blue
    Code:
                    If sToken = "Me" Then       ' use a set path of current code page
                        lPath = m_CodePage
                    ElseIf sToken <> sName Then ' else recordsets already filtered on the project
    
                    If sToken = "Me" Then       ' use a set path of current code page
                        lPath = m_CodePage: rsIndex = 2
                    ElseIf sToken = sName Then ' recordsets already filtered on the project
                        lPath = m_PrjRef: rsIndex = 2
                    Else
    2. In the same routine, towards bottom...
    Code:
          Else       ' object/item found, flag as non-zombie
    
          ElseIf rsIndex < 2 Then ' object/item found, flag as non-zombie
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  38. #38
    Frenzied Member
    Join Date
    Feb 2017
    Posts
    2,009

    Re: [vb6] Project Scanner

    Hello. Thank you LaVolpe for the great tool.

    I found a possible bug, and also there are some features I would like it to have if possible.

    1) The possible bug:
    In my vbExtra component I have a class module named cFontAttributes, it is a private class and it has only a few public variables (as un-validated properties) and nothing else, the actual code is:

    Code:
    Option Explicit
    
    Public Name As String
    Public Size As Single
    Public Bold As Boolean
    Public Italic As Boolean
    Public Underline As Boolean
    Public Strikethrough As Boolean
    Public Width As Long
    
    Public ForeColor As Long
    Public BackColor As Long
    Public Tag As String
    The tool detects all the variables as not used.
    They are not used in the class module itself but they are used elsewhere in the project because they are public.

    Some features I would like it to to have:

    2) The Copy feature already asked by Elroy, I think it is very necessary.
    In the time being I've made my own.
    I added to frmMain a menu entry named mnuCopy and this code:

    Code:
    Private Sub mnuCopy_Click()
        ' context menu item selected clicked
        Dim lIndex As Long
        Dim iText As String
        Dim iPos As Long
        Dim iStr As String
        
        If tvItems(1).Visible = True Then lIndex = 1
        If tvItems(lIndex).Nodes.Count = 0 Then Exit Sub
        
        Clipboard.Clear
        iText = Trim$(tvItems(lIndex).SelectedItem.Text)
        iPos = InStr(iText, " ")
        If iPos > 1 Then
            If Mid(iText, iPos - 1, 1) <> ":" Then
                If Mid(iText, iPos + 1, 5) = "{Fnc}" Then
                    iStr = "Function "
                ElseIf Mid(iText, iPos + 1, 5) = "{Sub}" Then
                    iStr = "Sub "
                ElseIf Left$(iText, 6) = "Raised" Then
                    iStr = Replace(Mid$(iText, iPos + 1), ":", "")
                    iPos = 1
                End If
                iStr = iStr & Left$(iText, iPos - 1)
            End If
        End If
        If iStr = "" Then iStr = iText
       Clipboard.SetText iStr
    End Sub
    3) Bigger font.
    The treeview font was a bit small for me to read comfortably, it would be nice to have a preference option to change it within the program. In my test, I changed its size form 8 to 11.

    4) Already asked by Elroy, it would be nice to have a recently opened file list. I particularly don't mind it to use the registry (is there any problem using the registry? Anyway most of the programs do it). Or otherwise using and INI file.
    This one is not important but still would contribute to the usability.

    Thank you.

    Edit: I found out that the zombie procedures are in fact handled so modified the original message.
    Last edited by Eduardo-; Dec 21st, 2018 at 08:07 PM.

  39. #39
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    196

    Re: [vb6] Project Scanner

    Why do I get the following error when I test? Is it because of Chinese?

    Type Mistmatch

    Name:  aa.jpg
Views: 1337
Size:  34.2 KB
    QQ: 289778005

  40. #40
    Frenzied Member
    Join Date
    Feb 2017
    Posts
    2,009

    Re: [vb6] Project Scanner

    Another bug: it seems that it has some trouble when the variables or procedures are used only qualified.

    For example, in my program I have a [tt]RECT[tt] type variable named [tt]mTabBodyRect_Prev[tt].
    The only references to this variable are to its members: mTabBodyRect_Prev.Left, mTabBodyRect_Prev.Top and so on. The scanner flag it as not used.

    Another case:
    In a bas module named mGUIStrings I have a procedure: Public Property Let GUILanguage
    It is only referenced in a GlobalMultiuse class module of the component in this way:

    Code:
    Public Property Get ExFnGUILanguage() As vbExGUILanguageConstants
        ExFnGUILanguage = mGUIStrings.GUILanguage
    End Property
    Then it is in fact used, but the scanner reports it as not used.

    Edit: another thing:
    After the validation utility has ran, if I want to run it again but with other options checked (or unchecked), I'm not able, the message instruct to re-scan the project.

    Also, I would like the program to remember the options as they were selected the last time (but it would also require to write to the registry or somewhere else).
    Thanks.

    Edit2:
    I suggest to use the bottom label to show the progress when loading the project instead of the treeview itself.
    I attached a modified version of the project that does that.

    Another bug: Private Sub/Function/Property when they are part of an Implementation.
    These procedures are flagged as zombies.
    They are not used elsewhere in the program but even when they are declared as Private, they are needed because are accessible publicly.
    Attached Files Attached Files
    Last edited by Eduardo-; Dec 5th, 2018 at 01:58 AM.

Page 1 of 6 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width