Page 3 of 7 FirstFirst 123456 ... LastLast
Results 81 to 120 of 260

Thread: [vb6] Project Scanner

  1. #81

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

    Re: [vb6] Project Scanner

    @Dex. I've some code from another source (will credit him) that checks for UTF8 with/without BOM and converts UTF8 without StrConv(), using APIs.

    That should do the trick and should allow strings to show their intended value in the treeview (theoretically), whether or not the user's regional settings match that of the scanned project when written. Again, all this assumes that non-US versions of VB writes UTF8 to allow unicode strings in the vbp, frm, ctl and other project files. If not, no harm, other than a very small speed bump checking for BOM-less UTF8 encoding. Initial tests look like its working just fine.
    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. #82
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: [vb6] Project Scanner

    So digging into that link I posted - the blogger is claiming that VC6 works with Unicode string literals (symbols still need to be ANSI I assume) _if_ the regional settings are set to an en-* locale. All other locales are ANSI/DBCS. So yeah - It's pretty odd that you might have to handle all those situations.

    edit:So basically VC6 expects the opposite of what you're thinking. Handle UTF-8 literals if its an en-* Locale otherwise its ANSI/DBCS.
    Last edited by DEXWERX; Dec 21st, 2018 at 02:54 PM.

  3. #83
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    Again, all this assumes that non-US versions of VB writes UTF8 to allow unicode strings in the vbp, frm, ctl and other project files.
    VB6 handling UTF-8 seems strange to me.
    When VB6 was made UTF-8 didn't exist yet (OK, it existed, but wasn't much used).
    Unless a VB6 service pack patched it to support UTF-8, I don't think it could be supported.

  4. #84
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [vb6] Project Scanner

    Ok, just to be clear, I took a VBP file, edited it so that the "Title" line looked like the following:

    Name:  UniTitle.png
Views: 1393
Size:  984 Bytes

    And then I saved it as UTF8 with BOM.

    And then, I loaded it with the VB6 IDE. It gave me that warning, but I told it to load anyway, which it did. Then, I went to the debug window to check on some things, as follows:

    Code:
    ? len(app.Title)
     7 
    
    ? app.Title
    a↕╥

    This tells me that it was not read as UTF8. But rather, the BOM was discarded and it was read as an ANSI file. And when it hit those UTF8 characters, it just read each byte as a character (as opposed to correctly reading the UTF8 multi-byte characters).

    I'd dearly love to get some Unicode in our source code, but I don't think it's ever happening with the existing VB6 IDE. Now, I suppose we could test to see what the C2 compiler can handle from a command line directive, but that's somewhat different from what we're discussing. And it would require that we use a different IDE for our VB6 development, which I don't think I'm willing to do.

    Merry Christmas,
    Elroy

    EDIT1: Also, let's not forget that UTF8 was designed to be backward compatible with ASCII (which is not at all true of either UTF16 or UCS2). Which means that an ASCII file can be read as UTF8 (but not vice-versa which is what VB6 tried to do in my example above).
    Last edited by Elroy; Dec 21st, 2018 at 02:52 PM.
    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. To all, peace and happiness.

  5. #85

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

    Re: [vb6] Project Scanner

    @Eduardo. A while back, I was looking at this from a different angle. I could hard code string literals with non-ANSI and VB had no issues with it. This is the link for that discussion. Among that discussion, I was able to create and load non-ANSI resource file items, i.e., Set Me.Picture = LoadResPicture("цветок", vbResBitmap). So, VB must be able to handle UTF8? I was also able to use Chinese similarly. However, LoadResPicture didn't support Chinese though a workaround was provided.
    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}

  6. #86
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [vb6] Project Scanner

    Quote Originally Posted by Eduardo- View Post
    VB6 handling UTF-8 seems strange to me.
    When VB6 was made UTF-8 didn't exist yet (OK, it existed, but wasn't much used).
    Unless a VB6 service pack patched it to support UTF-8, I don't think it could be supported.
    I always think/thought of UTF-16 (and its UCS-2 subset where the characters are always two-bytes) as the way Microsoft did things, and that UTF-8 was the way the rest of the world did things. In fact, it's my understanding that escaped URLs are basically escaped UTF-8. And yeah, they were both around prior to VB6.

    Therefore, since Microsoft has always been on the UTF-16 side of the fence, yeah, the VB6 IDE handling UTF-8 makes no sense to me.
    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. To all, peace and happiness.

  7. #87
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [vb6] Project Scanner

    WOW, I can't get that Set Me.Picture = LoadResPicture("цветок", vbResBitmap) into my IDE. Here's what I get when trying to copy-paste:

    Name:  UniTest2.png
Views: 1867
Size:  5.0 KB

    LaVolpe, if you did, I'd sure like to know how.

    EDIT1: I also tried several ways to make sure that the clipboard did, in fact, contain UTF-8, but I always got the same results when trying to paste into the VB6 IDE.
    Last edited by Elroy; Dec 21st, 2018 at 03:13 PM.
    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. To all, peace and happiness.

  8. #88

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

    Re: [vb6] Project Scanner

    @Elroy. If you really want to play with that, follow the other thread I referenced in post #85. You'll need to set your locale to Russian and your default language also to Russian. Memorize how to set them back to English because after you reboot, you won't be seeing English any longer until then
    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. #89
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: [vb6] Project Scanner

    I'm quite confident that when VB6 was designed, they ddidn't care about UTF-8 because even when it already existed, it was not known/used.
    It was years later when UTF-8 begun to be used, and even later it became an standard, at least for the web.

    If VB6 can handle UTF-8 in some of its features, it must be because it is doing that function through an API. And the OS's API is the one that was updated to handle UTF-8.

    Some info (not much): https://www.quora.com/Why-doesnt-Mic...-on-Windows-10

  10. #90
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: [vb6] Project Scanner

    @Dex. I've some code from another source (will credit him) that checks for UTF8 with/without BOM and converts UTF8 without StrConv(), using APIs.
    I always thought Vb6 IDE was ANSI and DBCS which depends on setting default LCID for non-Unicode apps.

    You'll need to set your locale to Russian and your default language also to Russian. Memorize how to set them back to English because after you reboot, you won't be seeing English any longer until then
    AFAIK you only need to change the default LCID for non-Unicode apps and not the Main language LCID.
    That is what I am doing here for testing and it appears to work OK.

    For example, when you set Administrator non-Unicode LCID to 2052, you can type Chinese for captions and comments in Vb6 IDE.
    You will need to install a keyboard IME for Chinese if you are using a U.S. English.
    It looks like Unicode UTF16 but since the Vb6 IDE is ANSI only(and DBCS) it is actually showing Chinese DBCS.

    This was discussed at:
    http://www.vbforums.com/showthread.p...network-folder.
    Thanks to Olaf for sugesting I switch to StrConv.
    See demo code in thread #14 for EncodeMBCS and DecodeMBCS.
    Turns out the OP was looking for a VbScript solution but since it was posted in Vb6 forum I originally provided a Vb6 solution.

    In the demo at thread #14, Chinese system non-Unicode LCID 2052, it displays "中文" but the same string displayed on U.S. system with Locale 1033 shows "ÖÐÎÄ"
    Two utilities are provided in the link below, EncodeMBCS and DecodeMBCS so you can convert strings from one LCID to another.
    I tried pasting Chinese Unicode "中文" in Vb6 IDE (with LCID 2052) but it just displays "??" (not suprising since we know Vb6 IDE is not Unicode).

  11. #91
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Hi LaVolpe,

    The attachment is the VBP used for testing:

    After I changed the company and description of pScanner.VBP to Chinese, this pScanner.VBP cannot be read by pScanner. In addition, I added a line of code to clsPrjFile.ParseFile to display the error message.

    Code:
    Public Function ParseFile(ByVal FileName As String, Caller As ICustEvent) As Boolean
    '...
    '...
    '...
    
    ExitRoutine:
        MsgBox "ParseFile Error:" & vbCrLf & vbCrLf & Error         '--- DreamManor Added on 2018-12-22 ---
        modMain.CreateBuffer m_Buffer.FileName, m_Buffer, Nothing, True, True
        Set colFiles = Nothing
        On Error GoTo 0
    
    End Function
    Attached Files Attached Files

  12. #92

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

    Re: [vb6] Project Scanner

    @dreammanor. Sorry, no errors on my end. I did get your "nullstring line" message, but that is expected at end of file (no more data to read). I did not get any other errors running the project you just posted. Do note that I had to change the ComCtl32 version to 1.3 to open the project because I don't have 1.4 installed as you do.

    Also note, that the vbp file is ANSI/UTF8 and those fields look like this in the zip file... Is that expected?
    VersionComments="ºÜ°ôµÄÏîĿɨÃèÆ÷"
    VersionCompanyName="¹«Ë¾(LaVolpe)"
    VersionFileDescription="ÏîĿɨÃèÆ÷"
    VersionProductName="ÏîĿɨÃèÆ÷"
    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. #93
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: [vb6] Project Scanner

    As mentioned in thread #90, this is LCID 2052 DBCS, not UTF8

    What you see on U.S. system
    ---------------------------
    VersionComments="ºÜ°ôµÄÏîĿɨÃèÆ÷"
    VersionCompanyName="¹«Ë¾(LaVolpe)"
    VersionFileDescription="ÏîĿɨÃèÆ÷"
    VersionProductName="ÏîĿɨÃèÆ÷"

    Converted to Chinese (LCID 2052)
    --------------------------------
    VersionComments = 很棒的项目扫描器
    VersionCompanyName = 公司(LaVolpe)
    VersionFileDescription = 项目扫描器
    VersionComments = 项目扫描器

    Translated Chinese to English w/Google
    --------------------------------------
    VersionComments = Great Project Scanner
    VersionCompanyName = Company (LaVolpe)
    VersionFileDescription = Project Scanner
    VersionProductName = Project Scanner

  14. #94
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Quote Originally Posted by DrUnicode View Post
    As mentioned in thread #90, this is LCID 2052 DBCS, not UTF8

    What you see on U.S. system
    ---------------------------
    VersionComments="ºÜ°ôµÄÏîĿɨÃèÆ÷"
    VersionCompanyName="¹«Ë¾(LaVolpe)"
    VersionFileDescription="ÏîĿɨÃèÆ÷"
    VersionProductName="ÏîĿɨÃèÆ÷"

    Converted to Chinese (LCID 2052)
    --------------------------------
    VersionComments = 很棒的项目扫描器
    VersionCompanyName = 公司(LaVolpe)
    VersionFileDescription = 项目扫描器
    VersionComments = 项目扫描器

    Translated Chinese to English w/Google
    --------------------------------------
    VersionComments = Great Project Scanner
    VersionCompanyName = Company (LaVolpe)
    VersionFileDescription = Project Scanner
    VersionProductName = Project Scanner
    Hi DrUnicode,
    you are right. Since VB6 IDE is ANSI, the Chinese chars we input in the VB6 IDE are not Unicode, but ANSI. For example: Ascii of "中" is -10544 (Asc("中") = -10544, Ascw("中") = 20013). So in our VB6 source code we need to judge "Asc(sChar) > 32 Or Asc(sChar) < 0". Olaf's cwTextBox can't input Chinese chars is the same reason.

  15. #95
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Hi LaVolpe:
    I made some changes to your code, now it can handle VBP files containing Chinese chars. But when I open my actual VB project with pScanner, there are still a lot of errors. I checked it and found that it was mainly caused by AscW(sChar) (AscW will generate an error when sChar is vbNullString). In other words, in your project, all AscW(sChar) needs to check whether sChar is empty. For example: pvScanDeclarations, GetToken, etc. This issue may be revised in the new year.


    Code:
    Public Function ParseFile(ByVal FileName As String, Caller As ICustEvent) As Boolean
    '...
    '...
    '...
    
    ExitRoutine:
        if Err then MsgBox "ParseFile Error:" & vbCrLf & vbCrLf & Error         '--- DreamManor Added on 2018-12-22 ---
        modMain.CreateBuffer m_Buffer.FileName, m_Buffer, Nothing, True, True
        Set colFiles = Nothing
        On Error GoTo 0
    
    End Function
    
    Private Function pvGetStatement_NoParse(sLine As String) As Boolean
    
        ' Purpose: replicate VB's Line Input statement, trimming the line
    
        Dim iPos As Long            ' current character position
        Dim iAsc As Long
        
        sLine = vbNullString
        If m_Buffer.cIndex > m_Buffer.length Then Exit Function
            
        With m_Buffer
            .iLTrim = 0: .iRTrim = 0
            For iPos = .cIndex To m_Buffer.length
                iAsc = .Bytes(iPos)
                If .iLTrim = 0 Then
                    If (iAsc > 32 Or iAsc < 0) Then .iLTrim = iPos          '--- DreamManor added "iAsc < 0" on 2018-12-12 ---
                ElseIf iAsc = 13 Then
                    Exit For
                ElseIf iAsc = 10 Then
                    Exit For
                End If
            Next
            .cIndex = iPos + 1
            If .iLTrim <> 0 Then
                Do Until .Bytes(iPos - 1) > 32 Or .Bytes(iPos - 1) < 0      '--- DreamManor added ".Bytes(iPos - 1) < 0" on 2018-12-12 ---
                    iPos = iPos - 1
                Loop
                .iRTrim = iPos
                sLine = Mid$(.Buffer, .iLTrim, .iRTrim - .iLTrim)
                pvGetStatement_NoParse = True
            End If
        End With
        
        '--- DreamManor Added on 2018-12-22 -------------------------------------------------------------
        If sLine = vbNullString Then
            If m_Buffer.cIndex <= m_Buffer.length Then
                MsgBox "Parse error(pvGetStatement_NoParse): sLine is a vbNullString" & _
                            vbCrLf & vbCrLf & "FileName: " & m_Buffer.FileName & _
                            vbCrLf & vbCrLf & "Error position: " & m_Buffer.cIndex & " / " & m_Buffer.length
            End If
        End If
        '---------------------------------------------------------------------------------------------------
        
    End Function

  16. #96

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

    Re: [vb6] Project Scanner

    Looks like I'll have some work to do to try to understand DBCS. But I think I might understand... DBCS can result in ASCII characters preceded with a null character? For example, the word "VersionComments" first character is not Chr(86), but something else like Chr(0), Chr(86)? If I process your file as UTF8 via APIs, I don't get Chinese, but I also do not get the ANSI text where DBCS exists. So, simply processing as UTF8 is not a solution either. I will have to educate myself a bit on DBCS.

    But here's a question.... Can you directly enter Chinese characters in the IDE? If you do, does VB save the file in DBCS like your examples or does it save it in UTF8? Also, if you cannot enter Chinese characters directly in the IDE, you had to manually patch the vbp file for the DBCS characters?

    In the meantime, this project cannot be successfully run with DBCS if DBCS can be placed anywhere in any VB code file.
    Last edited by LaVolpe; Dec 22nd, 2018 at 09:21 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. #97
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Yes, I can input Chinese chars directly in the VB6 IDE, and the Ascii of Chinese chars are all negative (for example: -10544). The VBP I sent to you is the VBP that I modified on my computer. I don't need to do any extra operations on Chinese characters. VB6 can handle Chinese chars very well, without any settings and third-party plugins. (Perhaps the Chinese OS has helped us do everything.)

    Although all my software is Chinese, Unicode is rarely used in our software. In fact, I know very little about Unicode. I only used Unicode once, and that is English phonetic symbols. I have no idea what DBCS is.

  18. #98
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [vb6] Project Scanner

    Ahhh, I now understand the problem. And it's still NOT a Unicode problem.

    Within the Windows-Code-Pages, there are Single-Byte-Character-Sets (SBCS) and Multi-Byte-Character-Sets (MBCS). (Again, nothing to do with any flavor of Unicode.) I think us Americans are most familiar with the SBCS-Code-Pages. In fact, I wasn't even aware the VB6 IDE could deal with the MBCS-Code-Pages, but apparently it can.

    In fact, here's an MSDN quote:

    Asc Function ... The range for returns is 0 – 255 on non-DBCS systems, but –32768 – 32767 on DBCS systems.
    Way back, when I first read that, I probably thought they were referring to Unicode, but I now don't think that's the case. I didn't test, but dreammanor seems to have shown this whereas Asc("中") = -10544 and Ascw("中") = 20013. And the MSDN is clear that Ascw returns a Unicode (i.e., UCS-2) interpretation.

    Also, just as another FYI, apparently Microsoft worked fairly hard to insure that all the initial Code-Pages (including MBCS ones) were translatable to UCS-2 (and vice-versa). I'm not at all sure that that's still true, and even Microsoft admits that this is a continually evolving effort.

    But, regarding VB6, I'd think we'd be fairly safe if we just read these ANSI-Code-Page source code files and just immediately converted them to UCS-2 Unicode before doing anything.

    LaVolpe, I didn't study your program enough to know if that's what you're doing. But it does seem that that's necessary if languages like Chinese are going to be correctly handled. If you're attempting to treat all source files as single-byte-characters, that's not going to work in the ANSI-MBCS cases.

    Merry Christmas,
    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. To all, peace and happiness.

  19. #99

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

    Re: [vb6] Project Scanner

    The above posts help.

    I am assuming you cannot name a variable or object (like a control) using Chinese characters. Is that correct? Reason for this is that VB specifically says that variables (really any vb code item) must begin with ANSI alphabet, i.e., A-Z, a-z. Other stuff might be allowed, like literals and comments.

    Edited: If my latest assumptions are correct, then changing the project will not be difficult at all.
    And as for the idea of trying to display in the treeview the intended characters (like Chinese) on any system will be abandoned. Though it may be possible (maybe not) to be 100% sure if DBCS is used or not, it isn't worth the effort I think. I doubt Chinese have the only DBCS locale so one would have to know which locale the files originated from to properly display any character as intended. Would have been nice, but oh well. Even NotePad punted on dreammanor's vbp file, defaulting to ANSI format.

    Quote Originally Posted by Elroy
    But it does seem that that's necessary if languages like Chinese are going to be correctly handled. If you're attempting to treat all source files as single-byte-characters, that's not going to work in the ANSI-MBCS cases.
    Actually, that's the opposite of what I wanted. I better understand DBCS now: kinda like ANSI + "unicode" combined into a single format, from cyberactivex site
    DBCS is actually not the correct terminology for what Windows uses. It is actually MBCS where a character can be 1 or 2 bytes. To illustrate this consider the following code which will take a Unicode string of English and Chinese characters, convert to a byte array of MBCS Chinese, dump the byte array to the immediate window, and finally convert it back to a Unicode string to display in a Unicode aware textbox. The byte array when converted using Chinese(PRC) LCID = 2052 contains single bytes for the english characters and double bytes for the Unicode characters.

    sUni = "2006" & ChrW$(&H6B22) & "9" & ChrW$(&H8FCE) & "12" & ChrW$(&H6B22) & " 8:04"
    Last edited by LaVolpe; Dec 22nd, 2018 at 11:43 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}

  20. #100
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    kinda like ANSI + "unicode" combined into a single format
    I'd be careful with a statement like that. I don't think ANSI (i.e., Windows Code Pages), even when MBCS, have anything to do with Unicode. In fact, the ANSI Code Pages are always specific to a specific language. Unicode (particulary UTF-16 or UCS-2) is something entirely different. Although, so long as your UTF-16 or UCS-2 usage is confined to a specific language, it can be converted to some Code Page language.

    --------------

    Now, just to confuse matters a bit more, there's actually a Code Page ID for UTF-8. In other words, you can treat the entirety of UTF-8 as a single language. The CodePage code is 65001. This works because ASCII is a subset of UTF-8. Therefore, from &h80 and above, the CodePage characters are just interpreted as UTF-8.

    Because UTF-16 (nor UCS-2) can correctly handle the ASCII characters (as one-byte-each), there is no CodePage for those. But that's basically what the StrConv() function is for (using vbFromUnicode or vbUnicode).

    Noting that there's actually a UTF-8 LCID makes for some interesting thoughts. For instance, we should be able to directly read a UTF-8 file if we specify the LCID = 65001. Or, we could use StrConv() to convert any of UCS-2, UTF-8, and/or default CodePage. However, I haven't tested to see if that actually works.

    And lastly, I'm not sure that VB6 has any good way of dealing with the full UTF-16 character set (including the 4-byte characters).

    EDIT1: Correction, it's 65001 (not 65501).

    EDIT2: Another correction. Apparently there actually is some ability to treat UTF-16 as a CodePage. I'm exploring these possibilities. I'm not at all sure VB6 can exploit these abilities though.
    Last edited by Elroy; Dec 22nd, 2018 at 04:59 PM.
    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. To all, peace and happiness.

  21. #101

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

    Re: [vb6] Project Scanner

    @Elroy, UTF isn't the answer here. Text converted as UTF8 (CP 65501) is not the same result as StrConv(text, ..., 2052)

    @dreammanor. I'm still struggling to figure out why you are getting an error and I am not.
    If I change only the following line in the existing project (not your modified version), I get Chinese characters and no errors at all.

    In modMain, routine: CreateBuffer
    from .Buffer = StrConv(bData(), vbUnicode) to .Buffer = StrConv(bData(), vbUnicode, 2052)

    If you are getting an error due to a null line, then calling StrConv() on your system is not the same as me calling the same function, passing 2052 as the locale. Could you do me a favor and save the array to file and upload it for me to review?

    1. For the vbp file only, after this line is called: .Buffer = StrConv(bData(), vbUnicode)
    2. Execute this code, changing the file location as needed
    Code:
    bData() = .Buffer
    Open "C:\blah blah\Lavolpe.dat" For Binary As #1
    Put #1, 1, bData()
    Close #1
    3. Zip and upload the dat file and also the vbp file

    Once I have those two files, I can compare the results to my system after calling .Buffer = StrConv(bData(), vbUnicode, 2052) on the same vbp file. In any case, I can review the array data and know why the error is occurring.
    Last edited by LaVolpe; Dec 22nd, 2018 at 11:37 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. #102
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    Reason for this is that VB specifically says that variables (really any vb code item) must begin with ANSI alphabet, i.e., A-Z, a-z.
    Check out 3.3.5 Identifier Tokens for strict definition, particularly simplified-Chinese-identifier might be of interest.

    Basicly codepage-identifier there means anything in &H80 to &HFF char range (so called extended ASCII) is treated for the purposes of identifiers as a letter too. E.g. my cyrillic letters are there too although I would have to be insane to use cyrillic var-names :-))

    cheers,
    </wqw>

  23. #103

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

    Re: [vb6] Project Scanner

    Quote Originally Posted by wqweto View Post
    Check out 3.3.5 Identifier Tokens for strict definition, particularly simplified-Chinese-identifier might be of interest.

    Basicly codepage-identifier there means anything in &H80 to &HFF char range (so called extended ASCII) is treated for the purposes of identifiers as a letter too. E.g. my cyrillic letters are there too although I would have to be insane to use cyrillic var-names :-))

    cheers,
    </wqw>
    Per MSDN
    A variable name:
    Must begin with a letter.
    Can't contain an embedded period or embedded type-declaration character.
    Must not exceed 255 characters.
    Must be unique within the same scope, which is the range from which the variable can be referenced — a procedure, a form, and so on.
    I guess the definition of a "letter" is unclear. Per your link, technically, it can be a codepage-identifier

    Edited: Yepper - never would've guessed (latin codepage). Compiles and runs
    Code:
    Dim ™ As Long    ' Chr(&H99)
    ™ = 100
    MsgBox ™
    
    Dim ºÜ°ôµÄÏîĿɨÃèÆ÷ As String
    ºÜ°ôµÄÏîĿɨÃèÆ÷ = "ºÜ°ôµÄÏîĿɨÃèÆ÷"
    MsgBox ºÜ°ôµÄÏîĿɨÃèÆ÷
    Last edited by LaVolpe; Dec 22nd, 2018 at 01:47 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}

  24. #104
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Quote Originally Posted by Elroy View Post
    Ahhh, I now understand the problem. And it's still NOT a Unicode problem.

    Within the Windows-Code-Pages, there are Single-Byte-Character-Sets (SBCS) and Multi-Byte-Character-Sets (MBCS). (Again, nothing to do with any flavor of Unicode.) I think us Americans are most familiar with the SBCS-Code-Pages. In fact, I wasn't even aware the VB6 IDE could deal with the MBCS-Code-Pages, but apparently it can.

    In fact, here's an MSDN quote:



    Way back, when I first read that, I probably thought they were referring to Unicode, but I now don't think that's the case. I didn't test, but dreammanor seems to have shown this whereas Asc("中") = -10544 and Ascw("中") = 20013. And the MSDN is clear that Ascw returns a Unicode (i.e., UCS-2) interpretation.

    Also, just as another FYI, apparently Microsoft worked fairly hard to insure that all the initial Code-Pages (including MBCS ones) were translatable to UCS-2 (and vice-versa). I'm not at all sure that that's still true, and even Microsoft admits that this is a continually evolving effort.

    But, regarding VB6, I'd think we'd be fairly safe if we just read these ANSI-Code-Page source code files and just immediately converted them to UCS-2 Unicode before doing anything.

    LaVolpe, I didn't study your program enough to know if that's what you're doing. But it does seem that that's necessary if languages like Chinese are going to be correctly handled. If you're attempting to treat all source files as single-byte-characters, that's not going to work in the ANSI-MBCS cases.

    Merry Christmas,
    Elroy
    Yes, what you said is very reasonable. In our VB6 software, all Chinese chars are single-byte-characters. In other words, Len("中") = 1, but LenB("中") = 2

    Merry Christmas !
    Last edited by dreammanor; Dec 22nd, 2018 at 09:17 PM.

  25. #105
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: [vb6] Project Scanner

    Quote Originally Posted by Elroy View Post
    But, regarding VB6, I'd think we'd be fairly safe if we just read these ANSI-Code-Page source code files and just immediately converted them to UCS-2 Unicode before doing anything.
    How do you know what LCID to use since the original creators Administrator Locale for non-Unicode apps is NOT stored in the Vbp file.
    In dreammanor example, how would you know that you need to use LCID 2052 to convert VersionComments="ºÜ°ôµÄÏîĿɨÃèÆ÷" to VersionComments = "很棒的项目扫描器"?

    And...if you do convert to Unicode then you would have to use Unicode controls for ProjectScanner.

  26. #106
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Hi LaVolpe,

    My projects is very large, so pScanner has encountered many new problems while scanning. Even if there is no Chinese chars in some bas files, pScanner still generate errors and exit VB6 IDE.

    I'm a little busy these days. When I have free time, I'll fix all the defects in the pScanner and add detailed comments, and then post the modified pScanner source code. But this may be a week later.

    In addition, Chinese chars can be used to declare variables, classes, and controls in VB6, although I never do this.

    员工.cls
    Code:
    Option Explicit
    
    Public 编号 As String
    Public 姓名  As String
    Public 性别 As String
    Form1.frm
    Code:
    Option Explicit
    
    Private mEmployee As New 员工      'Class: 员工
    
    Private Sub Form_Load()
    
        mEmployee.编号 = "0001"
        mEmployee.姓名 = "Tom.Zhang"
        
        MsgBox mEmployee.编号 & ", " & mEmployee.姓名
        
    End Sub
    Last edited by dreammanor; Dec 22nd, 2018 at 09:11 PM.

  27. #107
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Hi LaVolpe and DrUnicode, the attachment is the test file you want:

    Code:
    Public Function CreateBuffer(FileName As String, Buffer As CodePageStruct, _
                                Caller As ICustEvent, bNoArrayOverlay As Boolean, _
                                Optional ReleaseOnly As Boolean = False) As Boolean
    '...
    '...
    
     With Buffer
            '.Buffer = StrConv(bData(), vbUnicode)   ' get code data
            
            '--- DreamManor Added 2018-12-23 ------------------------------
            .Buffer = StrConv(bData(), vbUnicode, 2052)
            Dim bTestData() As Byte
            bTestData() = .Buffer
            Open "C:\1\Lavolpe.dat" For Binary As #1
            Put #1, 1, bTestData()
            Close #1
            Erase bTestData
            ' *** Note: ***
            ' Buffer.length -1 = 1731
            ' UBound(bTestData) = 3423     '???
            '----------------------------------------------------------------
    
            Erase bData()
            .tSA.cDims = 1                          ' nr of dimensions
            .tSA.cbElements = 2                     ' integer
            .tSA.rgSABlBound = 1                    ' one-bound same as string char indexing
            .tSA.pvData = StrPtr(.Buffer)           ' memory address
            .tSA.rgSABelements = .length + 1        ' number array items
            .cIndex = 1
            .iLTrim = 0: .iRTrim = 0
            .FileName = FileName
            ' overlay array onto the buffer string for faster parsing
            If bNoArrayOverlay = False Then _
                CopyMemory ByVal VarPtrArray(.Bytes), VarPtr(.tSA), 4&
        End With
    
    '...
    , ...
    Also, hope the following information is useful to you:

    Len("中") = 1
    LenB("中") = 2
    Len("abc中")= 4
    LenB("abc中")= 8
    LenB("abc") = 6
    Asc("中") = -10544
    Ascw("中")= 20013

    The above information is output in the debug(immediate) window.

    Merry Christmas and Happy New Year.
    Attached Files Attached Files
    Last edited by dreammanor; Dec 22nd, 2018 at 09:52 PM.

  28. #108

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

    Re: [vb6] Project Scanner

    Thank you for the file dreammanor. Will take a look at it tomorrow.
    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}

  29. #109
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [vb6] Project Scanner

    Quote Originally Posted by dreammanor View Post
    Len("中") = 1
    LenB("中") = 2
    Len("abc中")= 4
    LenB("abc中")= 8
    LenB("abc") = 6
    Asc("中") = -10544
    Ascw("中")= 20013
    As I understand it, all of the above is going to be assuming Unicode (UCS-2) except for the Asc("中") = -10544 statement. For that one, it's going to go to the MBCS CodePage and fetch the value from that CodePage, which clearly doesn't agree with the UCS-2 value (of 20013).
    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. To all, peace and happiness.

  30. #110

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

    Re: [vb6] Project Scanner

    @Dreammanor... Solution has nothing to do with testing for integer values < 0

    The problem is that the length of the file is not the same as the length of StrConv() when DBCS is in play. I did not know about, nor account for, reduction of overall bytes after string conversion. This logic flaw is causing your errors.

    In modMain.CreateBuffer, after this line: .Buffer = StrConv(bData(), vbUnicode)
    add this line: .length = Len(.Buffer)
    Without that line added, the .length variable is the file's length in bytes; now > string length in chars. The code assumed that LOF(x) = Len(StrConv(fileBytes)) for ASCII/ANSI files and DBCS breaks that.

    That was easy to figure out. However, it also causes another problem in modMain.IsFileDirty(). You won't be able to enter the validation routines until this is also done:
    change: If Not (lLen = lSize And lDateHigh = lDtHigh And lDateLow = lDtLow) Then IsFileDirty = True
    to: If Not (lDateHigh = lDtHigh And lDateLow = lDtLow) Then IsFileDirty = True

    I still need to add/tweak code to account for possible use of DBCS VB identifiers and VB identifiers that have characters in the ASCII range 128-255. But the above changes should allow you to at least play along for now, without any other code changes, as long as you are not using Chinese characters in actual code, including comments and string literals, for now.

    P.S. Don't add Chinese characters to the vbp "Title" entry. It will likely cause an error trying to add unicode to a non-unicode recordset field. Lots of little things in the code needs to be changed to support DBCS

    And to be completely honest. The reason I was not getting the same errors as you after using StrConv(..., ..., 2052), is that, for different reasons, I already modified my code with those changes. This was done a few days ago when I was playing with the idea of converting VB files to UTF8 which also experienced similar problems, in some cases. That didn't register with me, because I was thrown off when you said that testing for negative integer values solved your problem. What you did, solved a symptom but not the underlying problem.
    Last edited by LaVolpe; Dec 23rd, 2018 at 11:18 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}

  31. #111

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

    Re: [vb6] Project Scanner

    Updated posted today. Merry Christmas to all.

    Brief summary of major changes. Version not compatible with previous versions
    1. DBCS compatible I hope
    - changed 2 recordset fields to accept unicode characters
    - had to modify several routines to look for specific unicode characters: line-breaks and spacing
    - internally, unicode line-breaks/spacing are converted to ANSI for downstream parsing, as needed
    - if an ANSI system processes a DBCS project file, characters will not be displayed as unicode; displayed as shown in project file
    - source used to identify what special characters to look for: https://msdn.microsoft.com/en-us/library/dd361851.aspx

    2. Replaced DoEvents calls with GetQueueStatus API calls to see if DoEvents is needed. This should speed up overall processing quite a bit as less DoEvents calls are actually made. Idea came from a posting on this site & credited. See modMain.FauxDoEvents

    I'm not 100% sure this is completely compatible with DBCS (Chinese/Japanese/Korean) systems since I don't have a good project to test against. If someone is willing to post a sample project, that would be great. Here is what I'd like to see in the sample project...
    - project files in paths that include non-US characters
    - file names that include non-US characters
    - file extensions that include non-US characters (this could be a bit of a pain: save vb file (cls,frm,etc). Rename the file, then import into project)
    - Variables that use non-US characters, especially the 1st and last characters of the variable
    - Comments that use non-US characters
    - Anything else that you think could possibly break a parser that expects ANSI text
    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. #112
    Fanatic Member
    Join Date
    Jan 2015
    Posts
    596

    Re: [vb6] Project Scanner

    Thanks Lavolpe, using your FauxDoEvents, 2 sec less on the big calculation in one of my app.

  33. #113
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: [vb6] Project Scanner

    Hi LaVolpe,
    The new version has solved the previous errors and can be scanned normally.

    I upload a project, you see the screenshot, can you meet the test requirements you want?

    Name:  无标题.jpg
Views: 984
Size:  33.2 KB


    ss.zip
    Last edited by ChenLin; Dec 25th, 2018 at 09:52 PM.
    QQ: 289778005

  34. #114
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Hi LaVolpe, now your new ProjectScanner can open VBP files containing Chinese chars normally. You are an enthusiastic and rigorous expert. Much appreciate.

    There is a small problem, that is, my project is relatively large and Project Scanner scans them for a very long time. For example, it takes 425 seconds to scan one of my projects. If ProjectScanner could be optimized, that would be great.
    Attached Images Attached Images  

  35. #115

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

    Re: [vb6] Project Scanner

    Quote Originally Posted by dreammanor View Post
    There is a small problem, that is, my project is relatively large and Project Scanner scans them for a very long time. For example, it takes 425 seconds to scan one of my projects. If ProjectScanner could be optimized, that would be great.
    I'll take a look. Honestly, didn't expect to find projects with nearly 1/2 million executable statements. There are 2 speed bumps with this project

    1) Writing to the recordset. After about 50K - 100K entries, I have noticed a steady increase in write times. I'm sure that large project of yours has lots of recordset entries

    2) Parsing the project, character by character to find statements, join multi-line statements, ignore comments, ignore VB Attribute statements, identify conditional compiler directives, and identify events. Parsing the declarations sections of project files shouldn't be too bad, but parsing the procedures this way can be re-worked to speed up initial parsing, skipping most of the statements within the procedures. Procedures are actually parsed twice: once to locate the start/end position of each procedure during initial project load and again during validation. That first time may not always need a full parsing of every character and optimization can be applied there.

    Out of curiosity, the 425 seconds is just for the initial loading of the project? I'd imagine that doing a full validation will take even longer. P.S. Maybe a slightly better performance can be seen when compiled?
    Last edited by LaVolpe; Dec 26th, 2018 at 09:17 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}

  36. #116

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

    Re: [vb6] Project Scanner

    Quote Originally Posted by ChenLin View Post
    I upload a project, you see the screenshot, can you meet the test requirements you want?
    Thank you, I will download it later today to see if I can find any logic flaws with my code that is related to your sample project.
    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. #117
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    Honestly, didn't expect to find projects with nearly 1/2 million executable statements.
    Personally, I think those are precisely the projects where your scanner would be most useful. However, so long as I know it's not hung, I'm fine with it taking a bit of time, as this analysis is sort of a one-time (or infrequently performed) thing.

    Again, this is truly fantastic work.

    Happy Holidays,
    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. To all, peace and happiness.

  38. #118
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] Project Scanner

    Quote Originally Posted by LaVolpe View Post
    Out of curiosity, the 425 seconds is just for the initial loading of the project? I'd imagine that doing a full validation will take even longer. P.S. Maybe a slightly better performance can be seen when compiled?
    Yes, the 425 seconds is just for the initial loading of the project, and I have not done anything else, such as a full validation.

  39. #119

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

    Re: [vb6] Project Scanner

    Quote Originally Posted by dreammanor View Post
    Yes, the 425 seconds is just for the initial loading of the project, and I have not done anything else, such as a full validation.
    Just a follow-up so you don't think I'm ignoring you

    After trying many different methods, it comes down to the recordset object when sorting a field containing strings. For example, a recordset with 500K records, following applies and on a relatively fast PC (different PCs will have different results):
    Sorting on numeric field: 0.140625 seconds
    Sorting on string field: 11.796875 seconds
    That is a difference of 84 times slower

    The project uses sorting often. So, I'll need to look at it again and find places where I can let the treeview do the sorting (will be displaying far less items than the recordset contains) and also where sorting strings in the recordset is used for grouping rather than sorting. In that case, I can use a CRC value of the string for grouping purposes.

    The bottom line: I need to prevent the recordset from being sorted on string fields while still able to group/sort on those same fields in another way.

    Just a side note: recordset.Find on a string in same recordset is up to 7x slower than finding a numeric value. If I'm using a numeric value for grouping strings, i.e., crc32, then I can use Find on the crc32 value vs the string value. The cost of creating a crc32 search value should be minimal.
    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. #120
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: [vb6] Project Scanner

    @LaVolpe: Does building in-memory index with rs.Fields(sSortField).Properties("Optimize").Value = True has any effect on rs.Sort = sSortField?

    cheers,
    </wqw>

Page 3 of 7 FirstFirst 123456 ... 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