Results 1 to 5 of 5

Thread: Visual Basic 6 on Windows 7, Directory List Box Not functioning properly

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2011
    Posts
    5

    Visual Basic 6 on Windows 7, Directory List Box Not functioning properly

    Hi all

    The vb6 application i am working on is supposed to be migrated to windows 7.
    When i am trying to run the source code , the directory list box is taking windows/system32 instead of current application which is causing my application to fail.

    The installer is working fine. But Installed application is also not working properly


    Please help

    Thanx in advance

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Visual Basic 6 on Windows 7, Directory List Box Not functioning properly

    Welcome to the forums
    Quote Originally Posted by ankit.kaushal View Post
    the directory list box is taking windows/system32 instead of current application which is causing my application to fail.
    What is the exact code you are using and what does "fail" mean?

    What error message is being generated?

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Visual Basic 6 on Windows 7, Directory List Box Not functioning properly

    You can control that via code:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Dir1.Path = App.Path
    End Sub
    
    Private Sub Dir1_Change()
        File1.Path = Dir1.Path    '<<< filelistbox - comment it if you don't use it
    End Sub

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Visual Basic 6 on Windows 7, Directory List Box Not functioning properly

    People seem to forget that the current directory setting is as relevant in Windows as it was in DOS. With no other direction CreateProcess() sets the CD to the application path, but many callers of CreateProcess() do set a different CD. For example Shell Links ("shortcuts") can specify one.

    When running in the IDE test runs inherit the CD of the VB6 IDE, which means depending on how you started the IDE it might have different values.


    I'm getting a strong whiff of "this app was never cleaned up for Vista" here. Lots of sloppy things you got away with under XP, especially as a local admin, don't work quite the same way now that security is tighter. Writeable data in App.Path is one of the no-nos. Windows 7 only made a few more changes, but often Win7 is the first time a lot of code will have to run under WOW64, which brings issues of its own as well.

    Such Rip Van Winkle code needs a thorough review or you're likely to bump into issue after issue, often after deployment.

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2011
    Posts
    5

    Re: Visual Basic 6 on Windows 7, Directory List Box Not functioning properly

    @Hack

    the problem was that files are not present in that directory and it throws a file not found run time error '53'


    @Rhino bull

    thats a good suggestion , but that will mean changing code. Which i will have to do eventually after running out of oher options.

    i think in vb tutorials they clearly say that dirListBox points to current directory by default .
    I think this is exactly what microsoft mean when they say VBE IDE is no longer supported.

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