'Start Service
strServiceName = "Alerter"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
objService.StartService()
Next
'Stop Service
strServiceName = "Alerter"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
objService.StopService()
Next
If you are still creating Delphi 7 applications, then you may have had problems with UAC in Windows Vista, 7 and 2008, your application launches but is unable to eg. access the HKEY-LOCAL-MACHINE hive of the registry, what you need is to have the application launch with Administrative rights.
You could just rightclick on the application icon and choose “Run as administrator” however this is hardly professional for a program you distribute to others.
Well, it took a bit of Googling and a bit of experimenting, but here’s the recipe to creating UAC aware applications in Delphi 7.
- First, create a new application and save the project.
In the project directory you just created create 2 files;
. - The first file “UAC.MANIFEST” should look like this;
—————————————————————————–
<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>
<assembly xmlns=”urn:schemas-microsoft-com:asm.v1″ manifestVersion=”1.0″>
<assemblyIdentity version=”1.0.0.0″ processorArchitecture=”*” name=”UACAwareApplication” type=”win32″/>
<trustInfo xmlns=”urn:schemas-microsoft-com:asm.v3″>
<security>
<requestedPrivileges>
<requestedExecutionLevel level=”requireAdministrator”/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
—————————————————————————–
. - Second file “vistaprog.rc” should look like this;
—————————————————————————–
1 24 uac.manifest
—————————————————————————–
(yes it’s only one line)
. - Now you need to compile the “vistaprog.rc” file.
you do this by running the “brcc32.exe” (found in the Delphi Bin directory) with this parameter “brcc32.exe vistaprog.rc“, this will compile a “vistaprog.res” file (this is a bit different/easier on Delphi 2007 etc, see links at the bottom for more details).
. - Now you will need to modify your Delphi project.
In the “unit1.pas” file find {$R *.dfm} and insert {$R ‘vistaprog.res’} just below it, save the project and compile it.
You application is now Vista/Windows 7/2008 UAC aware, you will also notice that a small shield is added to the application icon.
When you run your application it will look aimilar to this;

Read more here;
http://www.zhou73.cn/index.php/article/zhou73/2009-02-18/195.html
http://www.zhou73.cn/index.php/article/zhou73/2009-02-18/196.html
http://ruminatedrumblings.blogspot.com/2008/03/vista-uac-manifest.html
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_22755023.html
I have for a long time been thinking about finding a good RSS reader, I have from time to time stumbled across some good sites with interesting content but the RSS reader in IE does not seem to be quite good enough. I don’t want to have to go into a special pane of IE to view my feeds, I would like them to pop up by them self.
Anyway, so far I have found this Alertbear (not Alertbar as I first though, but bear as in the animal), it is quite good – still missing a few customization options (I would like to be able to decide the update interval of EACH feed separately, but Alertbear only offers one update interval for ALL feeds).
Alertbear come preset with a bunch of feeds, and you can add your own feeds quite easily. Once you have added your feeds you can configure Alertbear to how often it checks for updates (sadly as mentioned only ONE interval, not one per feed) and what should be done once news are received (popup etc). Mine is set to show headlines for 20sec upon receiving them.
There is also a ‘History’ function, this is more like a regular RSS feed reader but quite a good one (you get it by right clicking the tray icon and clicking “Show history”).
All in all it seem like something very close to what I have been looking for (about 94% of my needs are met I would say), there are some cosmetic and customization issues but they are minor. Anyway, if you know of a better alternative do tell..
.
