C++bulder中的代码在win7下怎么获得管理员运行权限

C++bulder中的代码在win7下如何获得管理员运行权限。
如下代码访问注册表,在xp下正常。在win7下如果不手动已管理员运行则无结果,该如何自动获得管理员权限。



#include <registry.hpp>
 
void __fastcall CrnGetCommPortList(TStrings *lstComm)
{
    lstComm->Clear();
 
    TRegistry *reg = new TRegistry;
    TStringList *lst = new TStringList;
 
    try
    {
        reg->RootKey = HKEY_LOCAL_MACHINE;
        reg->OpenKey("HARDWARE\\DEVICEMAP\\SERIALCOMM", true);
 
        reg->GetValueNames(lst);
 
        for (int i = 0; i < lst->Count; i++)
            lstComm->Add(reg->ReadString(lst->Strings[i]));
    }
    __finally
    {
        delete reg;
        delete lst;
    }
}
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    CrnGetCommPortList(Memo1->Lines);
}
c++ xp

------解决方案--------------------
http://blog.csdn.net/chinabinlang/article/details/6461404
------解决方案--------------------
加入资源文件:
1 24 XXX.exe.manifest

------解决方案--------------------
[ExeName].exe.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="5.1.0.0" processorArchitecture="X86" name="CompanyName.ProductName.YourApp" type="win32"/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/> 
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

以资源文件编译进去。Win7会在图标上显示一个盾牌,提示使用管理员身份运行。
------解决方案--------------------
工程的选项里,Application,Runtime Themes改为use custom manifest