views:

941

answers:

4

I've just built a VS C++ 6.0 program using VS 2008. When I attempt to run or debug the application, Vista asks for permission. What is it about how the program is built that causes this? The program is being built and run from a subfolder of C:\Dev

This response made no sense to me as a solution to the problem.

A: 

The MVP was talking about having your code and project run from your user folder for example c:\users\yourname\appdata or something under that path.

Do not disable UAC to fix this problem otherwise your application will not run on another machine unless it to has UAC turned off. It is a very bad practice. Your application, in a perfect world, should request elevated permissions from the user.

typemismatch
A: 

If you're not an admin, then you probably don't have permission to execute programs in C:\Dev.

ilitirit
+3  A: 

Possibility 1:

Your program is marked as needing admin rights in its manifest

Possibility 2:

Your program is called setup.exe or install.exe - such program names always cause administrator rights to be required

For detailed explanation of those and other possibilities why you see this check [Getting to Know User Account Control Technet article]

Suma
+1  A: 

Thank you Suma. You're response is the best yet and helped me arrive at a solution. I have determined that cause is explained by your first suggestion. Renaming the file to something not containing the word 'setup" did not help.

Turned out I was mistaken. I have both VS 2005 and VS 2008 installed and when I tried opening the old .dsw file, it was 2005 that was launched and offered to upgrade the project. 2005 apparently created a manifest with only one line with the tag "assembly". Once I upgraded the project using VS 2008 a more extensive manifest file was created. I confirmed that the manifest is being embedded in my program by checking the Manifest Tool...Input and Output...Embed Manifest setting. This new manifest includes the following data:

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>

AlanKley