Page 2 of 7 FirstFirst 12345 ... LastLast
Results 41 to 80 of 250

Thread: [vb6] Project Scanner

  1. #41
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    696

    Re: [vb6] Project Scanner

    [contents removed]

    [TEST POST FROM EDUARDO USING FIREFOX - THIS POST CAN BE REMOVED BY A MOD AS IT POSTED OK USING FIREFOX]
    Last edited by 2kaud; Dec 5th, 2018 at 08:07 AM. Reason: TEST POST
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++20 Compiler: Microsoft VS2019 (16.8.6)

  2. #42

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

    Re: [vb6] Project Scanner

    @All, completely rewrote the tool but have not reposted it yet. This is just a follow up. Plan on reposting by this weekend at the latest.

    @ChenLin. That is a bug in the program. For now, just test for a null field, i.e., If IsNull(rsLocal.Fields(constFldAttr2)), and then skip that line.

    @Eduardo. Thank you for the bug reports -- will be looking at them. Some of the bugs you are reporting, I'm coding for, so I'm interested in why they are failing for you? For example, whenever a Implements is used, the code should recognize the Implemented class events (those that VB forces you to include even if not used) and not report those as zombies. This tells me that in your case, those events are not being recognized as events. Is there any way you can give me a some short examples in a sample project? P.S. I like the idea of allowing user to increase/decrease font size.

    ^^ Edited. Regarding class public variables -- good one. I'll have to treat them as public properties. In reality, that's what they are.

    ^^ Also I did find another unique bug in pvProcessWordList that could be part of the problems you are seeing? That word list is a sorted list. In my case, I had "words" in that list alphabetically as rs.Clone and also rsItems.EOF. That routine tries to speed up things by comparing the next word against the previous word. If they are the same, then skip it. For example, let's say in that word list we had "tRect.Left" and then "tRect.Right". Well, when tRect.Left is looked at, tRect is flagged as "used". The next "word" in the list is tRect.Right. Well tRect not searched for again because it was just checked. However, in my case with rs & rsItems, rsItems wasn't checked because the bug only looked at the length of the previous word (rs is 2 characters) and rsItems begins with those 2 characters. Since rs matched because of the bug, rsItems was never searched for and flagged as zombie/unused. This bug can occur when variables referenced in same routine begin with the same letters. In your case, let's say you also have a variable named mTab and that variable is referenced in the same procedure where you use mTabBodyRect. In that case mTab is flagged as used but mTabBodyRect will not be.

    The major changes I've done (not yet posted) are:

    1. The progress is displayed at the bottom of the treeview and the treeview nodes are dynamically expanded/created. This results in near zero delay between end of parsing the project and the treeview being populated initially.

    2. The project allows you to hide/unhide nodes in the validation listing and caches that state inside the recordset if the recordset is saved. Intent is for you to fix items in the validation, then hide them, removing the clutter. If at any time you want to unhide them, you can. Each time you modify the hidden state, you should resave the recordset to persist that state.

    3. All known bugs, except the latest by Eduardo, have been addressed and fixed. Even took some of Elroys suggestions: any code displayed by the project is sent to a txt or rtf file and displayed within their default viewers. The project no longer displays any code within itself. Instead of offering a context menu for copying a node caption, another Elroy suggestion, I allow the node to be set to "edit" mode and the user can copy from that what they want; but not allowed to actually modify the caption.

    4. Several other enhancements but will talk about those when I repost later this week.
    Last edited by LaVolpe; Dec 12th, 2018 at 08: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}

  3. #43

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

    Re: [vb6] Project Scanner

    @Eduardo, wanted to address this one separately. Regarding choosing some validation options and then going back and choosing other ones later, without having to re-scan the project. I agree that would be a good thing, but will have to rework several things. Why?

    During initial scan, only the declarations section of each file is fully processed so it can be displayed in the tree. During that processing, critical information is stored with each declaration item so that it doesn't have to be re-parsed during future validations. Procedures are not fully parsed, they are skimmed, and the only information that is stored is the procedure location and size within the code file and whether the procedure header/signature is a multi-line statement, i.e., has underscore continuation characters. Now, when validations are performed, information gathered and written to the recordset are relative to the options selected. The code was written for a one-time pass through the procedures, processing each "word" in the procedure. Most information written to the recordset was intended for one-time use only. For example, parameters are parsed only if needed. The routines expect them not to exist in the recordset at the time they are parsed. If the project were run again, they would be there and foul up the logic. That's just one example of many cases.

    What you are asking can be done, and am thinking about it. Just requires additional tracking during procedure parsing to ensure pre-existing flags, attributes, items don't mess up future runs of similar parsing. Also don't want to re-parse something that doesn't need to be
    Last edited by LaVolpe; Dec 12th, 2018 at 08:08 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}

  4. #44
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,585

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    @Eduardo, wanted to address this one separately. Regarding choosing some validation options and then going back and choosing other ones later, without having to re-scan the project. I agree that would be a good thing, but will have to rework several things. Why?

    During initial scan, only the declarations section of each file is fully processed so it can be displayed in the tree. During that processing, critical information is stored with each declaration item so that it doesn't have to be re-parsed during future validations. Procedures are not fully parsed, they are skimmed, and the only information that is stored is the procedure location and size within the code file and whether the procedure header/signature is a multi-line statement, i.e., has underscore continuation characters. Now, when validations are performed, information gathered and written to the recordset are relative to the options selected. The code was written for a one-time pass through the procedures, processing each "word" in the procedure. Most information written to the recordset was intended for one-time use only. For example, parameters are parsed only if needed. The routines expect them not to exist in the recordset at the time they are parsed. If the project were run again, they would be there and foul up the logic. That's just one example of many cases.

    What you are asking can be done, and am thinking about it. Just requires additional tracking during procedure parsing to ensure pre-existing flags, attributes, items don't mess up future runs of similar parsing. Also don't want to re-parse something that doesn't need to be
    Personally, that made sense to me from the beginning. I just knew you wouldn't deny a re-validate without re-scan if there weren't sound reasons. However, maybe a solution is this ... when they/we attempt to re-validate (after initial validation), You're prompted with something like the following: "The project must be re-scanned to do this. Do you wish to re-scan and then proceed to re-validation? (Yes/No)." Just a thought. (And I'm fine if you leave that part like it is. Thanks for the copy-paste considerations.)
    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. #45
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,969

    Re: [vb6] Project Scanner

    Hello LaVolpe,

    Quote Originally Posted by LaVolpe View Post
    For example, whenever a Implements is used, the code should recognize the Implemented class events (those that VB forces you to include even if not used) and not report those as zombies. This tells me that in your case, those events are not being recognized as events. Is there any way you can give me a some short examples in a sample project?
    I see that most of the Implements that I have are in fact recognized, but only one is not.
    This one is declared as:

    Code:
    Implements VB.Printer
    The "VB." must be the cause.

    The others bugs also have to be with dots.
    For example I have 1) an UDT and 2) a Class module declared As New.
    In both cases the variables are never referenced alone, but they are referenced by their members.

    UDT example:
    Code:
    Private Type RECT
        Left as Long
        Right As Long
        Top As Long
        Bottom As Long
    End Type
    
    Private Sub Test()
        Dim MyRect as RECT
        
        MyRect:Left = 100
        MyRect.Top = 100
    [...]
    End Sub
    Class module example:
    Code:
    Private Sub Test()
        Dim MyClass1 As New Class1
        
        MyClass1.DoSomething
    End Sub
    And there is another case that also has to do with a dot.
    I have a Public procedure let's say named MyProc in a bas module named Module1.
    The procedure is only used referenced as Module1.MyProc

    Used in that way it is flagged as zombie.

    I'll make a sample project, but later because now I need to leave.

  6. #46

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

    Re: [vb6] Project Scanner

    That VB.Printer was interesting. I coded the project to use a class' default interface methods when there is no default events interface. However, VB.Printer does have a default events interface, but that interface has no methods/events! So, I tweaked my copy of the code to use the default interface when there is no default events interface or that interface has no methods - problem solved.

    Regarding your latest examples. I cannot reproduce the problem here, but I know my code & yours are no longer exactly the same. Here is something you can try to narrow down the problem. In the pvProcessWordList routine, immediately after the FOR statement, add a line like this:
    If m_Words(m_WordLstIdx).List(n) = "MyClass1.DoSomething" Then Stop
    now you can walk the routine a bit to see what happens. If the For/Next loop exits with rsIndex having a value > 1 then the item wasn't found - which should be the problem.

    I've posted my current code below. But I'll take it down later -- it's not ready yet & still has some test code in it. If you can reproduce the problem with the latest code, please let me know. Thank you in advance

    ** attachment removed **
    Last edited by LaVolpe; Dec 12th, 2018 at 05: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}

  7. #47
    Addicted Member
    Join Date
    Jan 2018
    Posts
    149

    Re: [vb6] Project Scanner

    My code with collections of collections, i.e.

    Code:
    Item(1)(1).b
    Causes an "invalid procedure call or argument" error in pvProcessWordList; it's generating an empty token.

  8. #48

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

    Re: [vb6] Project Scanner

    Quote Originally Posted by ahenry View Post
    Code:
    Item(1)(1).b
    Causes an "invalid procedure call or argument" error in pvProcessWordList; it's generating an empty token.
    Thanx, will fix that. I knew doing this project, I'd run up against coding practices I wouldn't anticipate. That is one of them

    Edited: patched in my copy -- still expecting to repost no later than this weekend.
    Last edited by LaVolpe; Dec 12th, 2018 at 08:11 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}

  9. #49
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,969

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    Regarding your latest examples. I cannot reproduce the problem here
    I made some wrong assumtions.
    The cause of the problem was actually when there was another variable that was the same name but shorter. It had nothing to do with the dots.
    (That bug is now already fixed in your latest code)

    Only one "bug" remains, it is in the sample project that is attached.
    Attached Files Attached Files

  10. #50

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

    Re: [vb6] Project Scanner

    Version 2 of the scanner is now posted. Here is a list of key changes

    1. The lengthy delay many experienced after a large project was parsed and when the treview finally allowed you to mess with it is now gone. All tree nodes are dynamically created, on demand as needed. The 32K limit in nodes will be history. The project will nag you if you are displaying more than 5K nodes. Each time you collapse a tree branch, invisible nodes are removed which keeps the node count low.

    2. Completely rewrote how stuff is written to the recordset and when it is accessed during validation. Short story: stuff written the the recordset is parsed just once, any future access is from the recordset, not re-parsed. This enables the project to allow you to choose options to validate, then later validate with other options you haven't chosen. Requested by Eduardo.

    3. The treeview captions can be clicked on to set them in edit mode. You can copy anything from the caption, but you are not permitted to change the caption

    4. The project allows you to hide validations that you either don't care about, or have fixed. This just serves to reduce clutter and allows you to keep track of what validations you have reviewed or fixed. Once hidden, you can later unhide them if you choose. You should export the scan/validations database any time you make changes that way to persist them.

    5. Added new validation as requested by Elroy: Identify whether any variables use ReDim that have not been previously declared.

    As you ladies and gents play with this, will consider enhancements. Always welcome bug reports.
    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. #51
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: [vb6] Project Scanner

    Still getting an error.

    Name:  a1.jpg
Views: 444
Size:  39.5 KB
    QQ: 289778005

  12. #52

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

    Re: [vb6] Project Scanner

    Hmm, curious if it has to do with unicode? There is only one field in the recordset that allows unicode and if I'm trying to stuff unicode in any of those other fields, an error will occur. In the clsZombie's Validate procedure, comment out the "On Error GoTo ParsingErrors" line and try again. The code should stop on the line causing the error. That will help me troubleshoot it from here. Thank you.

    Important: If you comment out that On Error statement. When your code stops on the error, paste these lines in the Immediate window (Ctrl+G) and execute them, before you terminate the running code. The lines will release any existing memory overlays. Not doing that could result in the IDE crashing
    Code:
    modMain.CreateBuffer "", m_Buffer(0), Nothing, True, True
    pvOverlayToken True
    P.S. If you could translate that error description that could help too.
    Last edited by LaVolpe; Dec 17th, 2018 at 08:33 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}

  13. #53
    Hyperactive Member
    Join Date
    Jan 2015
    Posts
    418

    Re: [vb6] Project Scanner

    You should add check to find and validate CreateDC, ReleaseDC etc...
    helping to find memory leaks

  14. #54

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

    Re: [vb6] Project Scanner

    Quote Originally Posted by Thierry69 View Post
    You should add check to find and validate CreateDC, ReleaseDC etc...
    helping to find memory leaks
    Oops, you posted this on the wrong thread
    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}

  15. #55
    Hyperactive Member
    Join Date
    Jan 2015
    Posts
    418

    Re: [vb6] Project Scanner

    Non, in the project scanner, finding a way to check if all object created are well destroyed.

    I have a control, where I know I have somewhere a memory leak, trying to find it for many years without any success

  16. #56

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

    Re: [vb6] Project Scanner

    Oh, I see. The answer is no. The scanner does not track variables as they move across code, in or out of procedures, etc. When I was an active member on PlanetSourceCode, myself and others actually attempted to come up with a way of doing that. The result was a class that could be added to your project and it would track handles for you, but you had to pass handles to it for tracking and destroying. If the class terminated and any handles remained, it would destroy them. Don't have a link for it, if it still exists. And it wasn't fool-proof. Typically, you can't delete an object if it is selected into a DC (pre-Vista I believe). Not sure that's still true today. In that case, if the user failed to unselect a selected item (font, pen, bitmap, etc) from a DC, the deletion would fail anyway. But the class warned you because it also looked at the return value of the various Delete[xxx] APIs.

    I have a control, where I know I have somewhere a memory leak, trying to find it for many years without any success
    In my signature below, the "Memory Leak FAQ" might be useful?
    Last edited by LaVolpe; Dec 17th, 2018 at 08:58 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}

  17. #57
    Hyperactive Member
    Join Date
    Jan 2015
    Posts
    418

    Re: [vb6] Project Scanner

    Already tried to find with your doc.

  18. #58
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,585

    Re: [vb6] Project Scanner

    hahaha, I'm sorry Thierry69, but I had to chuckle. That would be a HUGE task to try and examine the flow of source code for all possibilities of a memory leak. In fact, just because user-input can alter the flow of the executing code, it'd basically be impossible. It's a good thought though.
    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.

  19. #59
    Hyperactive Member
    Join Date
    Jan 2015
    Posts
    418

    Re: [vb6] Project Scanner

    Sure, I am certain that it is not pôssible to find 100% of cases.

    I sent you a private message

  20. #60
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    Hmm, curious if it has to do with unicode? There is only one field in the recordset that allows unicode and if I'm trying to stuff unicode in any of those other fields, an error will occur. In the clsZombie's Validate procedure, comment out the "On Error GoTo ParsingErrors" line and try again. The code should stop on the line causing the error. That will help me troubleshoot it from here. Thank you.

    Important: If you comment out that On Error statement. When your code stops on the error, paste these lines in the Immediate window (Ctrl+G) and execute them, before you terminate the running code. The lines will release any existing memory overlays. Not doing that could result in the IDE crashing
    Code:
    modMain.CreateBuffer "", m_Buffer(0), Nothing, True, True
    pvOverlayToken True
    P.S. If you could translate that error description that could help too.
    The error prompt is:
    subscript out of range。
    QQ: 289778005

  21. #61

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

    Re: [vb6] Project Scanner

    ChenLin, thank you. But that doesn't help too much. From your screenshot, it looks like you were running a validation on this project? Did you make any changes to the project? I've scanned this project dozens and dozens of times with no errors.

    That error could possibly happen in pvParseWords, but I thought I handled every scenario to prevent that. I'd love to know how you got that error, so that I can fix my logic. If you can reproduce that error again, would you please tell me how so I can try to force the error also?
    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. #62
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,585

    Re: [vb6] Project Scanner

    Just an FYI, I finally found the time to run your latest on my very large primary project. It all ran through flawlessly. It took a while to load, and also to validate, but I love the new labels that show the progress. That's just what I needed to have confidence that it wasn't hung.

    I may have missed it last time, but it seems to have found two more cases of "Variant vs. String Functions" than it did before.

    Someday (or not) I'll clean up my "Duplicate Declarations" (571 of them), and my "Duplicate String Literals" (1706 of those). My "Zombie Check" was also a large number, but that's fine. I know I've got all kinds of code in that project that's not being used. That project serves a dual purpose: 1) It's the primary project on which I work and maintain, and 2) It's sort of a repository for code that I may use someday. As stated in my signature footer, I've also got an overflowing "random code folder", but stuff gets lost in that folder, and I don't trust a great deal that's in there. Anything that's in my primary project (used or not) has been well alpha-tested.

    Again, a HUGE thanks for the effort you've put into this.

    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.

  23. #63
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,969

    Re: [vb6] Project Scanner

    Hello, great work. All bugs that I previously reported seem to be fixed.
    Regarding the Stop/End detection, the last version seems to only detect End but not Stop statements.

    .................
    Some ideas: I didn't study the code of the scanner, then I prefer to ask it to you: do you store detailed information about the discoveries, I mean the line positions, where an issue starts, where it ends?
    I'm thinking, perhaps in the future, to make an Add-In, something simple that would have to be able to receive orders from the project scanner and highlight the text of the issue. May be to receive the orders via DDE or by some other means.

    Thinking more... after correcting an issue it would also be desirable to have that reflected in the list, could it be possible to re-scan just a module or just a procedure and update it without having to re-scan the whole project?
    Just thinking...

  24. #64
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    ChenLin, thank you. But that doesn't help too much. From your screenshot, it looks like you were running a validation on this project? Did you make any changes to the project? I've scanned this project dozens and dozens of times with no errors.

    That error could possibly happen in pvParseWords, but I thought I handled every scenario to prevent that. I'd love to know how you got that error, so that I can fix my logic. If you can reproduce that error again, would you please tell me how so I can try to force the error also?
    I haven't changed any code, and there are also errors in scanning other projects.

    My steps: Open a project - > Validation - > Do Validation.

    I thought it was the reason why the project directory contained Chinese, but in fact, copying the project to another directory would also cause errors.
    Last edited by ChenLin; Dec 17th, 2018 at 09:14 PM.
    QQ: 289778005

  25. #65

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

    Re: [vb6] Project Scanner

    Looking at your screen shot in post #51, the project seemed to parse fine initially. So the problem I think is in the pvParseWords routine. But I cannot get that error on my machine, Win10. In post #52 above, I mentioned how you can determine exactly what line of code is causing the error. That may help me in trying to narrow down the problem. I'm sorry, but without more information, I do not know what to look for. I am confused as to why it fails on your machine but not mine or anyone else, so far.
    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}

  26. #66
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: [vb6] Project Scanner

    The error occurred in Sub pvShowValidation, see the screenshot.

    Name:  aa.jpg
Views: 373
Size:  36.8 KB
    QQ: 289778005

  27. #67

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

    Re: [vb6] Project Scanner

    @ChenLin, that is where the msgbox is that displays the error. The error occurred in clsZombie's Validate routine. In that routine, when an error occurs during validation, it sets the recordset field to -1 and saves the error number. Then when the validation form closes, the recordset is checked for a -1 code and displays the error box.

    In order to know which line caused the error, you must comment the "On Error GoTo ParsingErrors" line in clsZombie Validate routine. I tried to explain that in post #52.

    Edited & for ChenLin... I may have discovered a problem with a recursion scenario that could logically result in an array changing before it is completely processed. I have uploaded the change to post #1 as a new zip.
    Last edited by LaVolpe; Dec 18th, 2018 at 04:18 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}

  28. #68
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: [vb6] Project Scanner

    Find the error line, prompt the error: subscript out of range。

    Name:  aa.jpg
Views: 377
Size:  33.3 KB
    QQ: 289778005

  29. #69

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

    Re: [vb6] Project Scanner

    @ChenLin. That does confuse me. That part of the program is trying to load the VB TLB for forms, classes, usercontrols, etc. This would have been done when the project was initially scanned. An error there can only happen in 2 cases:

    1. The project could not load the VB6.OLB type library. If this is the case, and your VB is installed in a path with Chinese characters, then I can only assume that the TLB reference I am using for parsing TLBs is not unicode friendly. You can help verify that this way:

    a. In the clsPrjFile class, look at the routine: pvAddReference
    b. Find these lines in the routine and add the blue line. Then when you run the project, after loading a project to scan, please check the Immediate window to see if anything was printed out there. If so, failure to load the TLB and that is not good.
    Code:
        On Error Resume Next                        ' attempt to load the TLB
        Set TLIinfo = tli.TypeLibInfoFromRegistry(sParams(0), iMajor, iMinor, lLCID)
        If Err Then
            Debug.Print "Err TLB load: "; sName; " "; sRef
    2. The recordset contains unexpected values. You can help check this also.

    a. In the clsZombie class, look at this routine: pvAddShadowMethods (same place where your error occurred).
    b. In that routine, after the "End Select" statement, add this. Then validate the project. If this your code stops on that line, unexpected values in the recordset.
    Code:
    If lType < ptModule Or lType > ptUnknown Then Stop
    Also, could you expand the "References" tree view node after the project is initially scanned? I am interested if there is any indication that the TLB failed to load. Thank you.
    Name:  vbref.png
Views: 313
Size:  16.1 KB

    Edited: I think it may be the LCID for your version of VB. That could very well be it. Here is an updated class. I hope this will fix the problem
    Attached Files Attached Files
    Last edited by LaVolpe; Dec 19th, 2018 at 05:46 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}

  30. #70
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: [vb6] Project Scanner

    I tested the error of the screenshots on all three computers, but Do Validation on other computers is normal and no error is returned.

    Name:  a1.png
Views: 349
Size:  21.4 KB
    QQ: 289778005

  31. #71

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

    Re: [vb6] Project Scanner

    I'll try to explain what is happening... ComCtl32 version 1.4 with the LCID shown in that line (not visible from your screen shot) was not found in your registry. This project then tries to find the version with a different LCID. If it cannot be found, then that scanned project should not be able to be loaded into VB IDE without errors. This project assumes any scanned project can be opened with VB and run without errors.

    Common controls version is a typical problem with downloaded VB projects. If your computer's installed version of the ocx is not equal to or greater than the version referenced in a project, then VB will display an error when you try to load that project. The trick is to open the vbp and other files, i.e., (.frm, .ctl, etc) and change the version to a lower version like 1.2. Now VB IDE should be able to load the project.

    This does give me an idea to be able to identify these problems with the Common Control versions and offer a solution to the user to prevent those errors.
    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}

  32. #72
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: [vb6] Project Scanner

    I'm sure this is a Chinese environment or something else: because not only is ComCtl32 not properly acquired, but not all can be obtained...
    QQ: 289778005

  33. #73
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    I quickly took a look at the source code, the project does not process Chinese. All "xxx > 32" in the project should be changed to "(xxx > 32 or xxx < 0)"
    Last edited by dreammanor; Dec 21st, 2018 at 07:52 AM.

  34. #74

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

    Re: [vb6] Project Scanner

    Quote Originally Posted by dreammanor View Post
    I quickly took a look at the source code, the project does not process Chinese. All "xxx > 32" in the project should be changed to "(xxx > 32 or xxx < 0)"
    I doubt that. VB variable names, procedure names, parameters, types, API, etc won't be in anything other than ANSI. It is possible that hard coded literals/strings could be? If that is possible, strings are processed as unicode just in case. In other words, there shouldn't be any non-ANSI stuff to parse, except maybe string values, which are not truly parsed anyway. If my ANSI-assumptions are not true, please someone zip up a sample form/class so that I can review it.
    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}

  35. #75
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    I doubt that. VB variable names, procedure names, parameters, types, API, etc won't be in anything other than ANSI. It is possible that hard coded literals/strings could be? If that is possible, strings are processed as unicode just in case. In other words, there shouldn't be any non-ANSI stuff to parse, except maybe string values, which are not truly parsed anyway. If my ANSI-assumptions are not true, please someone zip up a sample form/class so that I can review it.
    In the VBP file, ExeName32, Path32, Description, VersionFileDescription and VersionProductName may contain Chinese chars, which will cause the returned value(sLine) of "pvGetStatement_NoParse(sLine as String) As Boolean" to be a vbNullString.

  36. #76

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

    Re: [vb6] Project Scanner

    Those will be fine. There are 2 instances where the byte > 32 is tested in that routine. Finding 1st character of a line and right-trimming a line. Since a line in a vbp won't start with a non-ANSI character, the 1st scenario won't cause a problem. And since the values of those vbp properties will be a string enclosed with Chr(34), the 2nd scenario won't apply.

    However, and am glad you brought up that point... The project will not work with a unicode VB project file, vbp, form, etc. When I read the file, it is converted with StrConv to unicode. So a unicode file will become something like double-wide which will fail to load.

    Out of curiosity, do you have such project examples? I don't know how VB writes such project files: BOM, no BOM. I'll have to be able to recognize whether the file content is unicode or not.
    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}

  37. #77
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: [vb6] Project Scanner

    Do the Chinese systems use DBCS? Is there anything special that needs to be considered when handling DBCS vs ANSI. (ANSI APIs inherently handle DBCS)

  38. #78
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,585

    Re: [vb6] Project Scanner

    Ok, I'm confused. I always thought that all VB6 source files HAD to be saved as ANSI (including the VBP file). And, in fact, that's one of the reasons we have many of our Unicode limitations like Captions (etc). And that's why it never really mattered that the Properties Window didn't handle Unicode. Sure, we have many workarounds, but none of them involve saving Unicode versions of the source files (other than possibly stuffing a binary version of the Unicode into the ??X files).

    And, just for grins, I tried saving a VBP file as UCS-2 Big Endian, UCS-2 Little Endian, and also UTF-8 with BOM. And, in all cases, the VB6 IDE would have nothing to do with them. I even tried placing some UTF-8 characters in a source file that didn't have the BOM, and the IDE just expanded each UTF-8 character to multiple characters (treating them as ANSI).

    Even LaVolpe's statement, "It is possible that hard coded literals/strings could be?", is confusing to me. String literal constants are just written directly into the source file, so I don't understand how they could be Unicode. They might be Unicode once compiled. I'm actually not sure. But they're certainly not Unicode prior to that.
    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.

  39. #79

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

    Re: [vb6] Project Scanner

    @Elroy. VB can read UTF-8 format with and without BOM. It doesn't seem to want to load UTF-16, BOM included or not. With UTF-8 & BOM included, VB does throw an informational warning, but still loads the project -- incorrectly at times. It doesn't expect the BOM, so it misinterprets the 1st line of the vbp file and makes a best-guess. For other VB file types, probably gonna break them too if a BOM exists. As far as "expanding" the characters, it may very well rely on regional settings.

    @All. Unless someone can tell me that VB will load a true unicode file (with or without the BOM), i.e., 2 bytes per character in the file itself, I won't modify this code. Using StrConv() on the file does break this project in that case, but that scanned project can't be loaded in VB anyway. This project throws an error saying it couldn't parse the file. Primary assumption for this project is that any scanned project can be loaded into and run from the IDE without errors. Using StrConv() on a UTF-8 encoded file does not break this project, but may not reflect actual unicode characters in the validation option that lists duplicated strings. However, will that problem exist on the same system that produced those UTF-8 files, i.e., same regional settings?

    Edited. It'll take a bit of work, but I am reconsidering handling of UTF8 encoding... Here is a screenshot showing how this project can carryover the unicode characters even though my VB IDE cannot display them correctly.
    Name:  utf8a.jpg
Views: 258
Size:  34.1 KB
    Last edited by LaVolpe; Dec 21st, 2018 at 01:42 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}

  40. #80
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: [vb6] Project Scanner

    You're correct, VB doesn't handle Unicode (or UTF-8 even, since it's built off the same VC6 compiler). However VB should be able to handle DBCS which is treated like ANSI. From what I understand the VB6 runtimes built in string comparisons functions tend to choke on DBCS. Schmidt might know more on this.

    https://raymai97.github.io/myblog/ms...-since-vc6#vc6

    edit: You could replace your string comparison with ANSI APIs, which can handle DBCS.
    Last edited by DEXWERX; Dec 21st, 2018 at 01:52 PM.

Page 2 of 7 FirstFirst 12345 ... 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
  •  



Click Here to Expand Forum to Full Width