Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7523135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:42:27+00:00 2026-05-30T02:42:27+00:00

I have full admin privileges on my Windows 7 machine but when I run

  • 0

I have full admin privileges on my Windows 7 machine but when I run my application which creates a file on c:\ drive I get error code 5 (Access is denied). I know windows 7 doesn’t allow creating files in protected areas like c drive and program files and file explorer brings up ‘administrative’ message box if I copy a file there from somewhere else after which it does allows but can my application obtain write level access?

In my application, user gets to pick the folder where they want to create the file so if they choose c:\ drive s/he will obviously get this error which is not desirable.

void CTestDlg::OnBnClickedButtonCreate()
{
    CFile f;
    CFileException e;
    TCHAR* pszFileName = _T("c:\\test.txt"); // here i am hard coding path for simplicity.
    if(!f.Open(pszFileName, CFile::modeCreate | CFile::modeWrite, &e))
    {
        TRACE(_T("File could not be opened %d\n"), e.m_cause);
    }

}

As far as I have researched it seems I can’t by-pass the UAC dialog which is fine but my application don’t even present it (which is understandable as well) but what are my options?

I see my only option is to detect this in my own application if this is Windows 7 OS and than check for file path before creating the file and present a more user friendly message ‘windows 7 doesn’t like you to create file in this folder, choose a different folder or go back to xp’. Is this scheme the way to go on Windows 7? Is there any other way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:42:29+00:00Added an answer on May 30, 2026 at 2:42 am

    As Kolink noted, your application needs to run with administrator privileges. In order to do that automatically, embed a manifest as explained here.

    EDIT: For VS2010: Project Properties > Configuration Properties > Linker > Manifest File Change the ‘UAC Execution Level’ to the desired value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a full path which I would like to remove certain levels of
I have a full MS SQL Backup file that I would like to extract
I have a DLL which starts up some basic Windows programs: using System; using
I have FileField in my django model: file = models.FileField(upload_to=FOLDER_FILES_PATH) In Django admin section
I have an old update program written in vb6, which runs as admin. However,
I have a Razor site I made with full login/registration and Admin roles with
in my django application admin i have the names of my administrators listed and
I have admin access to a Windows 2003 server. The trust level is set
From VS2010 in Windows 7 using Directory.Delete(path) from the VS debugger. I have full
I need to recover/reset the admin password for JetBrain's TeamCity . I have full

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.