Results 1 to 40 of 260

Thread: [vb6] Project Scanner

Threaded View

  1. #11

    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}

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