That's because it requires adminstrator privilege. Change the project's setting from (#2 is required if it is Win32 program)
1.project -> properties -> Application -> View UAC settings:
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
2. project -> properties -> Compile-> Advanced compile options -> Target CPU
X86
========================================
An article descripts the detail:
Banish UAC Issues
User Account Control (UAC) issues usually result from improperly allowing administrator-level access in your applications. Learn how UAC works and make such problems a thing of the past.
By Kathleen Dollard
11/01/2007
Get Code Download
Q. My users are getting a security error when they run my application in Windows Vista. This application ran fine on XP, and I think it has something to do with User Account Control (UAC). All my users have administrator privileges on their own machines. I'm using Visual Basic in Visual Studio 2005 on XP for development. What do you think is wrong and how do I fix it?
A. Your problem probably is a UAC issue. Historically, some programs have been written in a manner that required administrator privileges. After years of cajoling developers to write their applications in a more