xp or vista?
-
How to check whether the os is xp or vista? Thanks
-
How to check whether the os is xp or vista? Thanks
I'm assuming you mean from code? Microsoft's recommended approach now is to call
VerifyVersionInfo
. Windows XP is version 5.1 internally; Windows Vista is version 6.0. The reason for the complicated API is that traditionally people calledGetVersion
orGetVersionEx
, but made mistakes in the comparison.Stability. What an interesting concept. -- Chris Maunder
-
I'm assuming you mean from code? Microsoft's recommended approach now is to call
VerifyVersionInfo
. Windows XP is version 5.1 internally; Windows Vista is version 6.0. The reason for the complicated API is that traditionally people calledGetVersion
orGetVersionEx
, but made mistakes in the comparison.Stability. What an interesting concept. -- Chris Maunder
Ya through code.. Thankyou very much.
-
I'm assuming you mean from code? Microsoft's recommended approach now is to call
VerifyVersionInfo
. Windows XP is version 5.1 internally; Windows Vista is version 6.0. The reason for the complicated API is that traditionally people calledGetVersion
orGetVersionEx
, but made mistakes in the comparison.Stability. What an interesting concept. -- Chris Maunder
If you try to do that in Vista, the UAC will be activated, and you'll be presented with somehting like this: You are attempting to retrieve sensitive system information. Your action is being reported to Microsoft, along with any personal information that might be stored on this system. Continuing on this course of action will void your warranty, and this instance of Vista will be reduced even further in functionality until your intentions have been verified. Continue this course of action - cancel or allow?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
If you try to do that in Vista, the UAC will be activated, and you'll be presented with somehting like this: You are attempting to retrieve sensitive system information. Your action is being reported to Microsoft, along with any personal information that might be stored on this system. Continuing on this course of action will void your warranty, and this instance of Vista will be reduced even further in functionality until your intentions have been verified. Continue this course of action - cancel or allow?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001Just to make it clear, since John didn't use the joke icon: it doesn't do this. UAC only fires when you run an application, or an application is run on your behalf which has:
- A manifest which sets the
requestedExecutionLevel
for the program to requireAdministrator (and also highestAvailable, if you're an administrator rather than a standard user) - The compatibility option 'Run as administrator' is ticked
- A compatibility shim detects the program should run elevated (e.g. for setup programs)
- You used the 'Run As Administrator' context menu option
If you have an administrator account, by default you get an infamous Cancel/Allow prompt; standard users get an 'over the shoulder' prompt for an administrative account name and password. The aim is to avoid constantly prompting the user for a password, which is deemed a security risk because if you're constantly entering your password, you stop thinking carefully about whether you should enter it in a given dialog and can end up disclosing it to something you didn't mean to. Standard users only see UAC prompts for
requireAdministrator
; code silently runs non-elevated forhighestAvailable
. If you're coding for Vista you should ensure that you're not trying to write to any protected locations and you should setrequestedExecutionLevel
toasInvoker
to enforce this. Omitting the manifest causes file system and registry redirection to occur, for some protected locations. Only if your application actually performs an administrative function should you use anything higher. Preferably you should split all administrative functions into a separate program, markedrequireAdministrator
, which you launch from the main application as required. As developers, we see many more UAC prompts than a regular user would, because we generally want our tools to affect global system state (e.g. for COM registration) and because Vista wasn't finalized before the last release of Visual Studio. I myself haven't moved across as some of my tools - eMbedded Visual C++, primarily - don't even work. VB6 SP6 doesn't work for a standard user on XP (which is peculiar, as SP5 did) which is presumably why it requires elevation on Windows Vista. Yes, these tools are archaic - nine years old now - but they remain vital to support the software that is in the market.Stability. What an interesting concept. --
- A manifest which sets the
-
How to check whether the os is xp or vista? Thanks
Check the OS version, there are many ways to do this as the other replies said. XP is 5.1 or 5.2, Vista is 6.0.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
Just to make it clear, since John didn't use the joke icon: it doesn't do this. UAC only fires when you run an application, or an application is run on your behalf which has:
- A manifest which sets the
requestedExecutionLevel
for the program to requireAdministrator (and also highestAvailable, if you're an administrator rather than a standard user) - The compatibility option 'Run as administrator' is ticked
- A compatibility shim detects the program should run elevated (e.g. for setup programs)
- You used the 'Run As Administrator' context menu option
If you have an administrator account, by default you get an infamous Cancel/Allow prompt; standard users get an 'over the shoulder' prompt for an administrative account name and password. The aim is to avoid constantly prompting the user for a password, which is deemed a security risk because if you're constantly entering your password, you stop thinking carefully about whether you should enter it in a given dialog and can end up disclosing it to something you didn't mean to. Standard users only see UAC prompts for
requireAdministrator
; code silently runs non-elevated forhighestAvailable
. If you're coding for Vista you should ensure that you're not trying to write to any protected locations and you should setrequestedExecutionLevel
toasInvoker
to enforce this. Omitting the manifest causes file system and registry redirection to occur, for some protected locations. Only if your application actually performs an administrative function should you use anything higher. Preferably you should split all administrative functions into a separate program, markedrequireAdministrator
, which you launch from the main application as required. As developers, we see many more UAC prompts than a regular user would, because we generally want our tools to affect global system state (e.g. for COM registration) and because Vista wasn't finalized before the last release of Visual Studio. I myself haven't moved across as some of my tools - eMbedded Visual C++, primarily - don't even work. VB6 SP6 doesn't work for a standard user on XP (which is peculiar, as SP5 did) which is presumably why it requires elevation on Windows Vista. Yes, these tools are archaic - nine years old now - but they remain vital to support the software that is in the market.Stability. What an interesting concept. --
Mike Dimmick wrote:
Just to make it clear, since John didn't use the joke icon:
I shouldn't have had to use the joke icon...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 - A manifest which sets the