Results 1 to 4 of 4

Thread: VB6 - ProgData.Path to fix the App.Path problem

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Lightbulb VB6 - ProgData.Path to fix the App.Path problem

    Lots of people are still struggling with old VB6 programs that run afoul of App Compat file virtualization in current versions of Windows.

    It looks like these programs need a quicker fix than a thorough review and rewrite. Here's another idea to help do this.


    ProgData.Path

    First, we add a Class called ProgData with a Property named Path. Then we change any path-building logic in the program that uses App.Path to use ProgData.Path instead.

    What ProgData.Path returns is a new path within CommonAppData (ProgramData) named the same as the installed application's path within Program Files (Programs).

    For:
    C:\Program Files\FuddCo\FuddApp
    We get back the folder expanded from:
    {CSIDL_COMMON_APPDATA}\FuddCo\FuddApp

    ProgDFix.exe

    To make this work, we need to relocate the writeable files from Program Files to the new ProgData.Path folder after creating it and setting security to allow all-user read/write/delete access.

    ProgDFix.exe can do this for you. Just run it once after installation and it will move those files and deal with the security settings for you. Note that to accomplish this ProgDFix.exe runs elevated, which is why you'd want to do it as a last step in your install if possible.


    Attachment

    The attached archive has all of the necessary code and some example files to play with. This is described in the included ProgData.rtf document.

    I hope it helps somebody.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by dilettante; Sep 3rd, 2011 at 05:40 AM. Reason: reposted archive, small code changes to add Documents property, updated documentation

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: VB6 - ProgData.Path to fix the App.Path problem

    There is an error in ProgDFix.

    App.path "Dummy" does not exist.

    Code:
      Err.Raise &H8004B100, TypeName(Me), "AppPath """ & RHS & """ doesn't exist"
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 - ProgData.Path to fix the App.Path problem

    I can't find any errors. I just tried it again and it works fine. If you read the ProgData.rtf guidance document, under Testing ProgDFix.exe the very first step is:
    • Copy the included folder Dummy under Program Files/Programs manually. This will be a simulated installed program, but without any EXE (just some folders and files).

    That puts the folder in place for testing.

    As the third step there says:
    • Note that the Project has a command line set up already for Dummy and some files and folders under that folder:

    Msg|Dummy|EmptyFolder|FolderToGetMoved|FileToGetMoved.txt
    So to test with a different installed program (or simulation folder) provide appropriate command line parameters.

    If you clear the command line in the IDE (Project|ProgDFix Properties... Make tab) the program will just terminate with "nothing to do."
    Last edited by dilettante; Sep 3rd, 2011 at 05:42 AM. Reason: typos, added highlight

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 - ProgData.Path to fix the App.Path problem

    Note:

    The example DummyApp PDW setup was tested on Vista SP2, Win7 RC, and XP SP3. No issues. Should also work fine with Win2K SP 2 or later. Should even work for Win9x (including Win95 with the Desktop Update).

    I need to build a Win7 SP1 VM yet but I expect no problems.

Tags for this Thread

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