Microsoft W7 updates breaking my program?-VBForums
Results 1 to 25 of 25

Thread: Microsoft W7 updates breaking my program?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Microsoft W7 updates breaking my program?

    Hello

    Using W7 and vb6.

    For some years, I have been using a vb6 program I wrote, which basically takes preselected word documents, edits them (change of title etc) and then converts them to pdfs.

    The compiled exe has suddenly stopped working, but *exactly* the same program with no alterations works perfectly from the IDE, although when recompiled it fails. It has been OK for years.

    The only thing in my system that has changed is the almost daily W7 updates from Microsoft. Are there any other similar experiences that suggest this is the problem?

  2. #2
    Fanatic Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    827

    Re: Microsoft W7 updates breaking my program?

    What errors are you seeing?

  3. #3
    Hyperactive Member
    Join Date
    May 2011
    Posts
    368

    Re: Microsoft W7 updates breaking my program?

    Quote Originally Posted by el84 View Post
    The only thing in my system that has changed is the almost daily W7 updates from Microsoft.
    That would be worrisome -- MS updates are usually once per month, rarely a second critical update per month.

    cheers,
    </wqw>

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    Would any other *W7* users confirm that? Mine look perfectly genuine in every respect. I get plenty of attempted spoofs and of course I do not click on them, but I am well used to recognising them. Also, all the normal Microsoft routines run faultlessly. Nothing else on my system crashes. Incidentally, I have now found that the malfunction in my program does not occur if I switch off the computer and start afresh.

  5. #5
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,175

    Re: Microsoft W7 updates breaking my program?

    I do not have auto updates turned on. It keeps wanting to download Windows 10 so I have not updated this system for a while.

  6. #6
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    805

    Re: Microsoft W7 updates breaking my program?

    As jpbro asked, what errors are you seeing? Without more information, I'm not sure any of us can help.

    (And as wqweto said, MS updates typically occur on Patch Tuesday - which is the second Tuesday of the month. Has your project been broken for two weeks?)

    OS updates that break arbitrary VB code are usually discovered quickly, so it's possible something else is at play. I haven't seen any issues with my own projects on Win 7 PCs over the past month, and no clients have mentioned crashes to me. The only Win 7 issue related to recent updates (that I'm aware of) are some IE issues described here.

    If a restart fixes the problem, that could also indicate program bugs like memory leaks, file locks (that aren't being released correctly), UAC/privilege issues (hidden by an elevated IDE), or other problems. If a Windows update broke your program, I would expect it to break every time - not just on subsequent runs.
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    Sorry for delay and thanks to all those who have responded.

    Re updates, I am on Windows 7, 64 bit, and I have set my machine to 'Check for updates...' (daily 3 am) '...but let me choose whether to install them'. On reflection they are not quite daily but they are certainly more frequent that once a month. When I get notified it is often just for one update. I'm pretty sure they are genuine (I'm very well practiced at identifying spoofs!).

    Now as to the problem, saying what error I get is pretty unhelpful because (unless I reproduce the whole program -- tedious for readers)I can only say it is related to an error trap I put into the program which detects a blank variable. It may be helpful just to add to my description of what the program does in post #1 that I have set vb6 references to include Microsoft Word 15.0 Object Library and Microsoft Scripting Runtime.

    I myself have suspected one of the issues mentioned in the last paragraph of Post #6, but am not sufficiently expert to go further on that.

  8. #8
    PowerPoster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,001

    Re: Microsoft W7 updates breaking my program?

    saying what error I get is pretty unhelpful because
    Just for grins tell us what the error is
    In order to understand recursion, one must first understand recursion….

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    It is simply what I myself programmed into a message box, so really it would be completely unhelpful but since you insisted for grins, I programmed it to say 'Warning! This file incorrect!', if one of my variables which expected a value had a blank. As you see the message itself does not help one iota! I might well have programmed it to say 'Rhubarb'...

  10. #10
    Fanatic Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    827

    Re: Microsoft W7 updates breaking my program?

    What about the code where you usually populate the empty variable? Are you catching errors there or using On Error Resume Next? Can you post the code?

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    Just going to bed in Australia (early riser). Will respond later. I suspect posting that code will raise questions needing more of the code, but I'll try . Later.

  12. #12
    Fanatic Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    827

    Re: Microsoft W7 updates breaking my program?

    It might, but if your variable isn't being set, then the error must be occurring somewhere (either in the code or in the logic). Chasing it up the chain might be the only way to figure out what's going wrong.

    Have a good night!

  13. #13
    PowerPoster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,001

    Re: Microsoft W7 updates breaking my program?

    Quote Originally Posted by el84 View Post
    It is simply what I myself programmed into a message box, so really it would be completely unhelpful but since you insisted for grins, I programmed it to say 'Warning! This file incorrect!', if one of my variables which expected a value had a blank. As you see the message itself does not help one iota! I might well have programmed it to say 'Rhubarb'...
    That is where I would try and trap the error then, since that is where the error takes it. Do you know how to trap an error code?
    In order to understand recursion, one must first understand recursion….

  14. #14
    PowerPoster
    Join Date
    Feb 2006
    Posts
    17,861

    Re: Microsoft W7 updates breaking my program?

    I think I read about this:

    Name:  Windows Broke.jpg
Views: 74
Size:  49.8 KB

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    Just been looking at what part of my program I can send that narrows down the possible problem.

    However, I think I'm missing the point now. I should emphasise that the program has been working faultlessly for many years. And now seems OK again. So I'm wondering if it was a RAM glitch (they are not unknown and can cause all sorts of odd errors) or even a stray cosmic particle (and no, I'm not being fanciful. That happens too!). I'll do further tests today and if it does not happen again, I'll leave it there. Otherwise, I'll tussle with deciding which parts of a tediously long program to post. One point basically, is that the error is the result of falling through a loop where I Look for certain variable, which if fails shows me the message box. It is logical error checking rather than error trapping per se. There is no numeric error message, just the one I wrote as part of an IF loop.

  16. #16
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    16,717

    Re: Microsoft W7 updates breaking my program?

    Not really a lot of info for us to provide any meaningful advice. You say a variable is unexpectedly blank. Seems obvious to check the routine(s) that set that variable and those that clear/unset that variable. Maybe you can tell us more about that specific case: what sets it and what clears 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}

  17. #17
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    4,035

    Re: Microsoft W7 updates breaking my program?

    Since it never fails when you run it in the IDE, then perhaps always run it from the IDE.
    You could try selecting the compile to pcode option and see if the exe ever fails when running pcode as opposed to native code.

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

    Re: Microsoft W7 updates breaking my program?

    Quote Originally Posted by el84 View Post
    ... saying what error I get is pretty unhelpful ...
    Let me just say that you saying what error you get was quite helpful for me. The way you originally wrote your question...

    Quote Originally Posted by el84 View Post
    The compiled exe has suddenly stopped working...
    ... I had visions of some program that wouldn't execute at all, such as a total failure to execute, or maybe even causing a page-protection-fault.

    Now, with your (still quite terse) additional information, I at least know it's the type of error that can be trapped with error trapping.

    However, I'm now inclined to believe that you're not correctly handling some permissions issue (that possibly got changed with a Windows update). Are you attempting to mess with files in the Windows folder? Are you attempting to mess with files in another user's area?

    You see, you're just not giving us enough information to help you, and you're also being quite mysterious, which doesn't help.

    Take Care,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge, to any person obtaining a copy without restriction. 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 where all my code has come from, 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. #19

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    Dear all

    Many thanks for your continued attempts to help me. I am under daily work pressure (although I'm 77!) so do not continuously work on this.

    Elroy, perhaps you are on the right lines?

    "However, I'm now inclined to believe that you're not correctly handling some permissions issue (that possibly got changed with a Windows update). Are you attempting to mess with files in the Windows folder? Are you attempting to mess with files in another user's area?"

    The problem is that I'm very much a self-taught vb6 coder and I probably make lots of errors in my structure which I get away with although they are wrong, and which some windows update or other have showed up. The frustration I have is that all is now OK, but it definitely was failing in the exe although it's been fine for years, while it is OK from the IDE. Someone suggested 'well, just run it from the IDE' but I am curious as to what happened after so long with OK use!

    "you're also being quite mysterious, which doesn't help."

    I am truly sorry for this. It is my continuing attempt to avoid boring you all senseless by posting all of my code. When I originally posted the problem I was expecting others to say 'Yes, it's happened to us' and I would then know it was our friends in Redmond(?). But it seems this is not the case, so maybe I've coded badly. So I will try to post what I think might be the relevant bits.

    Code:
    ' Project > References > Microsoft Word 15 Object Library
    ' also Microsoft File Scripting Runtime (for the FileSys stuff)
    ...
    Set wrdApp = CreateObject("word.application")
    ...
     ' If previous transmission folder exists then delete it
            Dim oldTx As String ' finds any ForMarket directory
            If Dir$(aPath & "\" & aMarket & "\For*", vbDirectory) <> "" Then
               oldTx = Dir$(aPath & "\" & aMarket & "\For*", vbDirectory)
                lblProgress.Caption = "Deleting old Tx dir"
                FSys.DeleteFolder aPath & "\" & aMarket & "\" & oldTx, force '
            End If
    ' Make new transmission folder
         FSys.CreateFolder aPath & "\" & aMarket & "\For" & aPlace & aDirDate
    ...
    With wrdApp
           .Documents.Open (FileName$)
           .WindowState = wdWindowStateMaximize
           .Visible = False
    End With
    ...
    ActiveDocument.Sections(1).Range.Select
        For Looper = 1 To 12
            Selection.Find.Execute m(Looper)
            If Selection.Start > 0 Then
                Selection.Range.Text = m(Looper)
                mFound = m(Looper)
                Exit For
            End If
        Next Looper
    ...
    If mFound <> "" Then  '#### This was the test that apparently failed in the exe 
            lblProgress.ForeColor = vbBlack
            lblProgress.Caption = "Replacing text..."
            With ActiveDocument.Sections(1).Range.Find
                .MatchWildcards = True
                .Text = mFound & "*^13" ' from found month to end para
                .Replacement.Text = aExamDate & "^13"
                .Execute Replace:=wdReplaceOne ' , Forward:=True ', Wrap:=wdFindStop ' only chge 1st iter'n
            End With
        Else
            wrdApp.Visible = False
            MsgBox "WARNING. No match for month found so this file incorrect", vbCritical
        End If
    ' save as PDF
        With wrdApp.ActiveDocument
             .ExportAsFixedFormat Replace$(NewFileName$, ".doc", ".pdf"), 17, False ' 17 is PDF
            .Close
         End With
    Perhaps it is helpful if I restate what the program does. It takes a specified Word document and then substitutes a screen-entered month for one that is on it, before saving it as a PDF. This apparently simple idea becomes lengthy because using various selection techniques such as grouped radio boxes and listboxes, the user selects particular word document and enters a chosen month and year. When the error occurred, the month substitution was the part that failed. The actual PDF conversion worked OK.
    Last edited by el84; Sep 29th, 2017 at 02:58 PM.

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

    Re: Microsoft W7 updates breaking my program?

    Hi el84,

    Regarding this...

    Quote Originally Posted by el84 View Post
    I am truly sorry for this. It is my continuing attempt to avoid boring you all senseless by posting all of my code.

    ...you really don't have anything to apologize for. I believe the vast majority of us are just geeks who enjoy helping people to get/keep VB6 programs going, and possibly poking a stick in the eye of Microsoft for abandoning us. Also, I know we're a wide range of ages and programming expertise.

    Personally, I appreciate you sharing a snippet of code with us. It helps me to attempt to identify the problem. Specifically, with what you've said above, I focused on this block of code...

    Code:
    
        ActiveDocument.Sections(1).Range.Select
        For Looper = 1 To 12
            Selection.Find.Execute m(Looper)
            If Selection.Start > 0 Then
                Selection.Range.Text = m(Looper)
                mFound = m(Looper)
                Exit For
            End If
        Next Looper
    
    Now, let me make a few comments and ask a couple of questions about that block.

    First, is the m() array a string array containing the names of the months in it?

    Next, I always do Word automation with late-binding, and you're clearly doing it with early-binding. However, I wasn't aware that you could directly access the ActiveDocument and Selection objects, even with early-binding. Maybe someone else can verify how this early binding works. If not, then this looks more like VBA code than VB6 code.

    Next, the Selection.Range.Text = m(Looper) line of code is confusing to me (but probably isn't related to the problem). We just found one of the m() elements, so why are we spending time replacing text in the Word document with itself.

    Now, you've stated that it works in the IDE. Therefore, I assume you've stepped through the code and verified the values of things such as aPath, aMarket, aPlace, aDirDate, and m(1 thru 12). It's sort of old-school, but I'd also validate these values in the compiled program. You can't use tracing, so you'll just have to print them out. You could use the following to do this...

    Code:
    
        MsgBox aPath & vbCrLf & aMarket & vbCrLf & aPlace & vbCrLf & aDirDate & vbCrLf & _
               m(1) & vbCrLf & m(2) & vbCrLf & m(3) & vbCrLf & m(4) & vbCrLf & _
               m(5) & vbCrLf & m(6) & vbCrLf & m(7) & vbCrLf & m(8) & vbCrLf & _
               m(9) & vbCrLf & m(10) & vbCrLf & m(11) & vbCrLf & m(12) & vbCrLf
    
    
    I'd tend to put that code in just before your Looper loop. That might provide lots of clues to the problem for you.

    And one last thing. You're obviously using Word automation. I can tell you that Microsoft "tweaks" on the Office Object Model between versions (and also possibly between service releases (i.e., updates)). I also do a great deal of Word and Excel automation from VB6, and I'm constantly running down little bugs on each new release of Microsoft Office.

    I suppose that begs another question. You've got in your comment that "Project > References > Microsoft Word 15 Object Library". Have you recently updated that from a prior version of Office?

    However, I've never seen discrepancies in automation between IDE executed and compiled executed. So, I'm not so sure that's the answer.

    Again, I'd start examining variable values in the compiled code, verifying that you're doing precisely the same thing as you are when executing from the IDE.

    Maybe some of that will help.

    Good Luck,
    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, to any person obtaining a copy without restriction. 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 where all my code has come from, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

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

    Re: Microsoft W7 updates breaking my program?

    Elroy also laughs at Dilettante. I had to read that magazine cover several times just to figure out what he was talking about.
    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, to any person obtaining a copy without restriction. 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 where all my code has come from, 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.

  22. #22

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    ...you really don't have anything to apologize for. I believe the vast majority of us are just geeks who enjoy helping people to get/keep VB6 programs going, and possibly poking a stick in the eye of Microsoft for abandoning us.

    Thanks for very quick reply, and you encouragement which cheered me up no end (trying to find the reason for a pre-amp motor boating at the moment. I'll try to further understand what I'm doing and reply further, but for now I must comment on your second sentence. I am glad you say 'the vast majority'. I soon found a person who apparently takes a delight in *not* helping a flounderer and I have blocked him here.

  23. #23

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    < >
    Last edited by el84; Sep 29th, 2017 at 04:38 PM.

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

    Re: Microsoft W7 updates breaking my program?

    hahaha, well, I do think I know who/what you're talking about. Don't block him. He's actually quite bright and quite knowledgeable about VB6. He just has a sardonic personality that takes a bit of work to overlook.

    Hmmm, well, regarding the pre-amp motorboating, I'm not sure. Just hum along with it.

    Take Care,
    Elroy

    EDIT1: Hahaha, you posted before I could reply.
    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, to any person obtaining a copy without restriction. 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 where all my code has come from, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  25. #25

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    590

    Re: Microsoft W7 updates breaking my program?

    Several problems here

    First, I cobbled together pieces of code from elsewhere (some of which I didn't understand but found they worked). Second this was some time ago so I don't reliably remember what they were all about.. However, I'll struggle on. The easy answer is m(12).

    In the Form_load procedure, I define m(1) as "January" etc., so yes to that.

    Now re early and late binding I don't fully understand that.

    Not sure about your comment on the Selection.Range.Text line. Are you saying I could remove it?

    Re the M$oft tweaks, that was what I wondered. And yes, in the original code it was 14 and not 15, but it has worked since.

    Now the big thing about all this is that it all works now, compiled as well as IDE, so I don't think there would be any point in any of these tests now unless the problem returns if ever.

    As an electronics person, I do still wonder about a possible RAM glitch as well as a stray cosmic particle! I know the last part sounds fanciful but it is a fact that such particles can slip bits.
    Last edited by el84; Sep 29th, 2017 at 04:52 PM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.