I have been programming in Windows XP/2003 before. Now some customers use the Vista system to runProgramAn error is reported. My program uses the registry and reads and writes to HKLM. The security mechanism of Vista is definitely not allowed. When other software encounters this problem, there is a Windows security prompt, ask if my program runs as an administrator. If no prompt is displayed, an error is reported. Later, I found the solution on the Internet, so that my program also supports Vista.
Procedure:
1. Create a res File
Create a text file named by yourself. Here is UAC. manifest. content:
<? XML version = "1.0" Encoding = UTF-8" Standalone = "Yes" ?> <Assembly xmlns = "Urn: Schemas-Microsoft-com: ASM. V1" Manifestversion = "1.0" > <Trustinfo xmlns = "Urn: Schemas-Microsoft-com: ASM. V3" > <Security> <requestedprivileges> <requestedexecutionlevel = "Requireadministrator" /> </Requestedprivileges> </Security> </trustinfo> </Assembly>
Create a text file named UAC. Rc. content:
1 24 UAC. manifest
Compile it into the UAC. Res file and run:
Brcc32 UAC. RC-fouac. Res
2. InCodeIntroduced in
Open the project file and add
{$ R uac. Res}
3. Compile the program
In this case, the program supports Vista. When running, a Windows Prompt box is displayed asking you if you are allowed to run as an administrator.