I am looking for working (obviously) Delphi 7 code so I can check whether my program is started with administrator rights.
Thanks in advance
[--- IMPORTANT UPDATE ---]
Having reviewed the code in the answers so far, I realise that my question maybe is not so clear, or at least is not complete:
I want to know whether my Delphi 7 program is started with the 'Run as admin' check box set.
In other words: I want to know whether it is possible for my Delphi 7 program to create/update files in the c:\Program Files... folders.
Just checking if you have administrator rights is not enough for this.
The Microsoft recommended way to solve this issue: Split the application into two.
http://msdn.microsoft.com/en-us/library/aa511445.aspx
The first app checks whether it is necessary to run the second one.
The second app contains a "require admin" manifest (like David wrote) and you open it with the ShellExecuteEx 'runas' verb.
In case of a web updater the workflow could be like this:
Updater1.exe
Updater2.exe
This has several advantages:
It also works on Windows XP, you get presented with a login dialog if you are not an admin.