CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2010
    Posts
    50

    Smile UAC My first days with C#

    I am learning C#, my application needs to run on Vista and 7, but UAC turned on always reports error of access violation. I tried Right-Click-To-Run-As-Admin but it didn't help. How can I run the application without turning it off ?
    Thank you.

  2. #2
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: UAC My first days with C#

    You need a manifest file. When you run your application, the UAC dialog will pop up to ask permision for you application.

    Just google for 'C# manifest' and I'm sure you'll find something usefull.

  3. #3
    Join Date
    Jun 2008
    Posts
    2,477

    Re: UAC My first days with C#

    Like Danny said, a manifest file is the way to go if you *absolutely* need to run as an admin. However, you should ask yourself if you actually need this in the first place. You very may well need admin privileges, but if you post the problem at hand we may be able to help you find a way around it.

  4. #4
    Join Date
    Jul 2010
    Posts
    31

    Re: UAC My first days with C#

    Thank you,
    I only copy and paste a code snip on the net into my Console to loop through my Cdrive's directories to display all files, but I am reported as unable to access some folder without an admin priviledge. I right click my application.exe but the problem remains at a different location. I wonder how different it becomes to use a manifest to run as an admin and to choose Run as Admin by rightclick of my mouse ?
    If a manifest works best always through Vista and 7's security, then I guess MFC's life is going to end very soon , am I correct ? Or is it that people might have 'immigrated' into C# long before I think so ?

  5. #5
    Join Date
    Jun 2008
    Posts
    2,477

    Re: UAC My first days with C#

    Why do you think that an MFC application would be unable to request administrative privileges?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured