Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. 3 Vista questions

3 Vista questions

Scheduled Pinned Locked Moved C#
questionhelpsecuritytutorialworkspace
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Muntyness
    wrote on last edited by
    #1

    Hi, I have 3 quick Vista questions. The first question, is how can I tell if my program is running on Vista? (I've run accross the OperatingSystem class and the Environment.OSVersion value in my googling, but I can't find out if this class should be used for Vista, or what values I'd need to look for.) My second question, is how do I get to the users applications folders? (I know that they're all in the C:\Users\ folder, but I don't know how to get to a specific users folder.) My last question is to do with Services in Vista. I need to start a service from my program if it hasn't already been started. However when trying to start it (using the myservice.Start() function) I get a InvalidOperationException. I've been told that this is a security issue with the program, however running the program as administrator doesn't help. Anyone have any clue as to how to get around this problem? Thanks in advance, Munty

    L P L M 4 Replies Last reply
    0
    • M Muntyness

      Hi, I have 3 quick Vista questions. The first question, is how can I tell if my program is running on Vista? (I've run accross the OperatingSystem class and the Environment.OSVersion value in my googling, but I can't find out if this class should be used for Vista, or what values I'd need to look for.) My second question, is how do I get to the users applications folders? (I know that they're all in the C:\Users\ folder, but I don't know how to get to a specific users folder.) My last question is to do with Services in Vista. I need to start a service from my program if it hasn't already been started. However when trying to start it (using the myservice.Start() function) I get a InvalidOperationException. I've been told that this is a security issue with the program, however running the program as administrator doesn't help. Anyone have any clue as to how to get around this problem? Thanks in advance, Munty

      L Offline
      L Offline
      leckey 0
      wrote on last edited by
      #2

      We have a Vista board for your questions.

      _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

      D 1 Reply Last reply
      0
      • M Muntyness

        Hi, I have 3 quick Vista questions. The first question, is how can I tell if my program is running on Vista? (I've run accross the OperatingSystem class and the Environment.OSVersion value in my googling, but I can't find out if this class should be used for Vista, or what values I'd need to look for.) My second question, is how do I get to the users applications folders? (I know that they're all in the C:\Users\ folder, but I don't know how to get to a specific users folder.) My last question is to do with Services in Vista. I need to start a service from my program if it hasn't already been started. However when trying to start it (using the myservice.Start() function) I get a InvalidOperationException. I've been told that this is a security issue with the program, however running the program as administrator doesn't help. Anyone have any clue as to how to get around this problem? Thanks in advance, Munty

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        1. System.Environment.OSVersion.Version.Major > 5 2. Application.LocalUserAppDataPath 3. Use Net start.

        Deja View - the feeling that you've seen this post before.

        M 1 Reply Last reply
        0
        • L leckey 0

          We have a Vista board for your questions.

          _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

          D Offline
          D Offline
          Dan Neely
          wrote on last edited by
          #4

          Did you read his questions or just fire off the subject? They're all "how do I make my C# program do Foo", not "where in the vista control panel is foo hiding" questions.

          -- You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer

          1 Reply Last reply
          0
          • M Muntyness

            Hi, I have 3 quick Vista questions. The first question, is how can I tell if my program is running on Vista? (I've run accross the OperatingSystem class and the Environment.OSVersion value in my googling, but I can't find out if this class should be used for Vista, or what values I'd need to look for.) My second question, is how do I get to the users applications folders? (I know that they're all in the C:\Users\ folder, but I don't know how to get to a specific users folder.) My last question is to do with Services in Vista. I need to start a service from my program if it hasn't already been started. However when trying to start it (using the myservice.Start() function) I get a InvalidOperationException. I've been told that this is a security issue with the program, however running the program as administrator doesn't help. Anyone have any clue as to how to get around this problem? Thanks in advance, Munty

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Adding to what Pete said, NT is known as 5.0, XP is 5.1 and Vista is 6.0 (the next big client OS will be 7.0) :)

            Luc Pattyn


            try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


            1 Reply Last reply
            0
            • M Muntyness

              Hi, I have 3 quick Vista questions. The first question, is how can I tell if my program is running on Vista? (I've run accross the OperatingSystem class and the Environment.OSVersion value in my googling, but I can't find out if this class should be used for Vista, or what values I'd need to look for.) My second question, is how do I get to the users applications folders? (I know that they're all in the C:\Users\ folder, but I don't know how to get to a specific users folder.) My last question is to do with Services in Vista. I need to start a service from my program if it hasn't already been started. However when trying to start it (using the myservice.Start() function) I get a InvalidOperationException. I've been told that this is a security issue with the program, however running the program as administrator doesn't help. Anyone have any clue as to how to get around this problem? Thanks in advance, Munty

              M Offline
              M Offline
              Muntyness
              wrote on last edited by
              #6

              Hi Guys, Thanks for the answers. I'm going to test them out now. - Munty

              1 Reply Last reply
              0
              • P Pete OHanlon

                1. System.Environment.OSVersion.Version.Major > 5 2. Application.LocalUserAppDataPath 3. Use Net start.

                Deja View - the feeling that you've seen this post before.

                M Offline
                M Offline
                Muntyness
                wrote on last edited by
                #7

                Hi Pete, Thanks for the other 2 answers. They're doing what I want them to. :) Net Start doesn't work on the Vista machine I have. It gives me an "System Error 5" message. Just to note, but the "myservice.Start()" and "Net Start "myservice"" works on my XP machine. Some further information about the service. As long as I start the service from the Services admin tool, it does what I want it to. It's just getting the service started by the program that's the problem. (The program needs the service running in order to work.) Any ideas? - Munty -- modified at 10:29 Monday 23rd July, 2007

                P 1 Reply Last reply
                0
                • M Muntyness

                  Hi Pete, Thanks for the other 2 answers. They're doing what I want them to. :) Net Start doesn't work on the Vista machine I have. It gives me an "System Error 5" message. Just to note, but the "myservice.Start()" and "Net Start "myservice"" works on my XP machine. Some further information about the service. As long as I start the service from the Services admin tool, it does what I want it to. It's just getting the service started by the program that's the problem. (The program needs the service running in order to work.) Any ideas? - Munty -- modified at 10:29 Monday 23rd July, 2007

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  The only other way that I can think to do this would be to use the Service API. This[^] code shows the C++ equivalent of what you want to do.

                  Deja View - the feeling that you've seen this post before.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups