Results 1 to 7 of 7

Thread: [RESOLVED] VB6 Project takes forever to come up and run on first time launch only

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2017
    Posts
    440

    Resolved [RESOLVED] VB6 Project takes forever to come up and run on first time launch only

    I usually start my VB6 projects by double clicking on the .vbp file which always brings up the project in the IDE mode. Then, from the IDE I click on the Start arrow on the menu bar (the arrow pointing right) to run the application. Now, everytime it's the first time I run the app (after the first time I launch the project) it takes a very long time for the app to actually come up and show the Form. On the second time thru the last time (after closing out the app but not the IDE) I click on the Start arrow the app comes up very fast as long as I haven't closed the project. But if I close the project and bring it up again I'm back to the very slow startup of the app on the first run only. There is nothing going on in the app that doesn't go on each time I run the app so why is it very slow the first time but then thereafter the app starts up fast.

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

    Re: VB6 Project takes forever to come up and run on first time launch only

    Your anti-virus possibly? I use Avast and can have that problem for some apps, not VB in my case. Almost always happens after I compile an app and run it the first time.

    You can test that idea. Turn off your AV and open/run the project as before. If the lag disappears, likely the AV. Remember to re-enable the AV after testing.

    Others can tell me if I'm off on this guess... Do you run VB elevated each time, i.e., "as administrator". If not, do that and see if the problem seems to go away
    Insomnia is just a byproduct of, "It can't be done"

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

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


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

  3. #3
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,120

    Re: VB6 Project takes forever to come up and run on first time launch only

    Dunno what your app does, but maybe it is using a file stored on - and therefore waking up - an external drive?
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2017
    Posts
    440

    Re: VB6 Project takes forever to come up and run on first time launch only

    I don't have any anti-virus software running. The app does open files on an external drive but I would think that the drive would already be awake since prior to running the project I'm always looking at some of the files manually to see if they contain the correct data. I can run the app from the IDE over and over many times and except for the first time it always starts up very fast. The if I close the project then right away fire it back up the first time I run the app it's slow but thereafter it starts up fast. Haven't tried running the EXE yet.

  5. #5
    Frenzied Member
    Join Date
    Dec 2014
    Posts
    1,051

    Re: VB6 Project takes forever to come up and run on first time launch only

    I would try:

    copy the whole project in a internal drive, and see if its the same.
    external drives can be slow, even if its not in stand-by.
    once u start it, VB6 will have everything in memory and thats why it run faster the second time.

  6. #6
    Junior Member
    Join Date
    Mar 2020
    Posts
    28

    Re: VB6 Project takes forever to come up and run on first time launch only

    do you have a bunch of windows open? i.e., like do you have 40 code windows open in the background? sometimes - if you go one by one, close them ALL - then resave your project, that will fix it...

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2017
    Posts
    440

    Re: VB6 Project takes forever to come up and run on first time launch only

    Quote Originally Posted by baka View Post
    I would try:

    copy the whole project in a internal drive, and see if its the same.
    external drives can be slow, even if its not in stand-by.
    once u start it, VB6 will have everything in memory and thats why it run faster the second time.
    I moved everything, project and all files to the C drive and that didn't change anything. Later, after experimenting around with the project I found this:

    Code:
    Private Sub Form_Load()
       '
       '
     For n = 0 To Dir1.ListCount - 1
       s = Dir1.List(n)
       
       List1.AddItem Right(s, Len(s) - InStrRev(s, "\"))
             
       WritePrivateProfileString "MovieInfo", "Index", CStr(n), Movies & List1.List(n) & "\MovieInfo.ini"
     Next n
       '
       '
    End Sub
    Here I am loading two thousand movie titles into List1 and then for each title I update the INI file with the index number of the movie title. I put a break point right after the Next n line and ran the program. It took a very long time for it to reach the break point. I then went back and commented out the WritePrivateProfileString line and ran the program again. This time it reached the break point without delay. So my conclusions are that it was the WritePrivateProfileString line that was causing the very long delay in bringing up the screen

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