dcsimg
Results 1 to 11 of 11

Thread: [RESOLVED] Making Application to run on Windows 7

  1. #1

    Thread Starter
    Member CherryPickle's Avatar
    Join Date
    Aug 2009
    Location
    South Africa
    Posts
    40

    Resolved [RESOLVED] Making Application to run on Windows 7

    I have an existing apllication that run on XP. What do I need to do to make my application to run on Windows 7.

  2. #2
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Making Application to run on Windows 7

    If you are using only .Net classes, avoiding deprecated methods, and not attempting to write to or read from protected memory/disk space, then you should be ok.

  3. #3

    Thread Starter
    Member CherryPickle's Avatar
    Join Date
    Aug 2009
    Location
    South Africa
    Posts
    40

    Re: Making Application to run on Windows 7

    Can you please define deprecated method and protected memory/disk space.

    What does windows regard as protected memory/disk space?

  4. #4
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Making Application to run on Windows 7

    Deprecated methods or classes are those classes and methods that were released with earlier versions of the framework and have since been rendered obsolete by improvements.

    Protected memory/disk space could be directories that you're not allowed to read or write to with current user privileges, protected memory could be memory associated with another process.

  5. #5

    Thread Starter
    Member CherryPickle's Avatar
    Join Date
    Aug 2009
    Location
    South Africa
    Posts
    40

    Re: Making Application to run on Windows 7

    My program write settings into the registry (localmachine/software/myappname), and also write to a database and directory in my program folder under programfiles.

    Will this be allowed if not, is there a way past it?

    The software has been in use (code vb6) for the past number of years by about 400 users mostly running XP. We recently migrated to vs2008.

  6. #6
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Making Application to run on Windows 7

    My program write settings into the registry (localmachine/software/myappname), and also write to a database and directory in my program folder under programfiles.

    Will this be allowed if not, is there a way past it?
    I think if you want to write to those locations then you need to include a manifest file with your program that specifies that it needs to be invoked as an administrator. Its pretty easy to do but means that users might see a prompt every time they use your program asking if they want to allow it to run. If this sounds like a pain then you need to change the way your program works to make it fall in line with what microsoft considers to be good program practices. As far as I see it Program Files, as the name suggests, is supposed to be just for the program's files such as EXEs and DLLs. Any user specific data that needs to be modified should be stored in the user's profile for example.

    One thing to note, if you want to take advantage of new Windows 7 features like Jump Lists, there are built in .NET classes in WPF 4.0 (which comes out in the next couple of months with Visual Studio 2010 / .NET 4.0) that let you do this with ease
    Last edited by chris128; Jan 9th, 2010 at 08:41 AM.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  7. #7

    Thread Starter
    Member CherryPickle's Avatar
    Join Date
    Aug 2009
    Location
    South Africa
    Posts
    40

    Re: Making Application to run on Windows 7

    How do include the needed settings in the manifest file?

    The files it saves to the program files folder is temp files the program works with, and then clean-up after use. User responses and results are saved in the database.

    I am in the process to re-write the software using the latest technologies, but for now I need to get it running on windows 7 to keep my users happy.

  8. #8
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Making Application to run on Windows 7

    Temp files, by their name, should be saved to the Temporary Folder. This has the added advantage of cleaning itself up after use, even if you don't!

    Use System.IO.GetTempPath() to retrieve the path to the temporary folder on the machine. If you replace
    Code:
    Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
    with
    Code:
    System.IO.GetTempPath()
    everwhere in your code, you likely won't have to change anything else! Nor will you need administrator elevation, which should be avoided like the plague unless absolutely necessary.

  9. #9

    Thread Starter
    Member CherryPickle's Avatar
    Join Date
    Aug 2009
    Location
    South Africa
    Posts
    40

    Re: Making Application to run on Windows 7

    Thanx, it helped.

    For purpose of someone else reading this thread, the reference should be
    System.IO.Path.GetTempPath()

    Now just one more thing how do I edit, and what code should go into the manifest to allow me to edit the registry. For now I donít mind my user having to give my app permission to continue.

  10. #10
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Making Application to run on Windows 7

    Well its only certain parts of the registry that you cannot edit without admin permissions, so the best way to do it would be to rewrite your program so that instead of storing data that needs to be changed in the HKEY_LOCAL_MACHINE hive, you store it in the KEY_CURRENT_USER hive. Of course if the data in the registry only needs to be read and not modified then you dont have anything to worry about, you can just have your application's installer write the data to the HKEY_LOCAL_MACHINE hive and then the application can just read it from there.
    If you do not provide a manifest file at all then I believe Windows 7 will do the same as Vista and will virtualize the registry access for you. What this means is that if your program tries to write to a restricted area like HKEY_LOCAL_MACHINE\Software, then windows will transparently redirect the registry write to a location in HKEY_CURRENT_USER. This feature is intended to be used for older programs that were written before UAC was around so if you are rewriting your app to work with Windows 7 then you should not rely on it and should just try to do things "properly" and write to the unrestricted areas of the registry.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  11. #11

    Thread Starter
    Member CherryPickle's Avatar
    Join Date
    Aug 2009
    Location
    South Africa
    Posts
    40

    Re: [RESOLVED] Making Application to run on Windows 7

    Thanks for the help.

    My app relies on writing to the LocalMchine hive. I will change it in my next update, but for now I need to work around it.

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
  •  



Featured


Click Here to Expand Forum to Full Width