1. Microsoft has announced the release of the Windows 10 Technical Preview. Read more...

Windows 7 Do you want to allow the following program to make changes to this computer?

Discussion in 'Programming and Scripting' started by gppsoftware, Feb 6, 2011.

  1. gppsoftware

    gppsoftware New Member

    Joined:
    Feb 6, 2011
    Messages:
    4
    We are in the process of modifying some applications to run under Windows 7, however, when we run them, we get the ""Do you want to allow the following program to make changes to this computer?" message from UAC.

    I know how to turn UAC off to prevent this, but that is dealing with the symptoms rather than the problem. We would like to write our applications properly so that the error message does not appear in the first place.

    Can anyone provide a definitive list of program actions which trigger the error message ?

    Interestingly, when debugging our VC++ 2008 applications, the error message appears before any of the code actually runs, so evidently, it is not just the code which counts.
     
  2. Nibiru2012

    Nibiru2012 New Member

    Joined:
    Dec 16, 2009
    Messages:
    466
    UAC automatically does that with ALL programs, it's the nature of the beast, so to speak. Regardless of what program it will do that. It has nothing to do with the application you're running.

    Just turn off UAC and you won't see it.
     
  3. gppsoftware

    gppsoftware New Member

    Joined:
    Feb 6, 2011
    Messages:
    4
    Hi Nubiru,

    Thankyou for your reply, but unfortunately, we can't just turn UAC off - many of our clients mandate its use so we have to fit with it.
    Microsoft manage to not trigger UAC as do many other software products, so evidently it can be done. What we want to know is how do the code for this ?

    Regards
     
  4. Veegertx

    Veegertx Well-Known Member

    Joined:
    Nov 19, 2009
    Messages:
    433
    Won't cure the asking for elevation but it made it less annoying allowing me to do things I needed

    Code:
     
    'Verify we working with Win 7. I think Vista fits here also
    Str1 = Reg_Read(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName")
    If InStr(Str1, "Windows 7") Then
       Str1 = Reg_Read(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", MyAppPath & "YOURAPP.exe")
     If Str1 <> "# RUNASADMIN" Then
       Reg_Write HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", MyAppPath & "YOURAPP.exe", "# RUNASADMIN", REG_SZ
       Reg_Write HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", MyAppPath & "YOURAPP.exe.exe", "# RUNASADMIN", REG_SZ
     End If
    End If
    
    Edit: These keys are worth exploring.
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\CaretTracking
     
    Last edited: Feb 13, 2011
  5. ickymay

    ickymay New Member

    Joined:
    Jan 12, 2009
    Messages:
    1,694
    Last edited: Feb 13, 2011
  6. Veegertx

    Veegertx Well-Known Member

    Joined:
    Nov 19, 2009
    Messages:
    433

Share This Page