You can tell that WordPress is created by geeks when they bring out a new feature like the one below which allows me to post syntactically highlighted code into my blog. Most of the regular vistors, with a few notable exceptions – you know who you are – will not give two stuffs about this feature but it is pretty cool.

Here’s some code from one of the apps that I work on (this one is from a dentistry software house – I write all but one of their products).

[geek alert]For those that need to know it runs the passed application with elevated administrator permissions on Windows Vista [/geek alert]

procedure TfrmSequences.RunAsAdmin(hWnd: HWND; afile: string; aParameters: string);
sei: TShellExecuteInfoA;
// Execute 'aFile' with aParameters  as the parameters
// with a request for elevation to Adminstrator level on Windows Vista
FillChar(sei, SizeOf(sei), 0);
sei.cbSize := SizeOf(sei);
sei.Wnd := hWnd;
sei.lpVerb := 'runas';
sei.lpFile := PChar(afile);
sei.lpParameters := PChar(aParameters);
sei.nShow := SW_SHOWNORMAL;
if not ShellExecuteEx(@sei) then RaiseLastOSError;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s