Hello, I am planning to use ShellExecute for the updater of an application written in delphi 2007, I was wondering if ShellExecute will work on most computers with Win or if it can easly fail because of some user permission or something like that.
+1
A:
I believe shellExecute does require admin. You didn't mention the OS. If it is Vista+ then UAC comes in to play. see this explanation
Ken Lange
2009-12-07 02:48:26
You believe incorrectly. ShellExecute does not require administrative privileges in and of itself. (Think about it: Double-clicking a document in Explorer doesn't require elevated privileges, and ShellExecute is exactly what gets called in that situation.)
Rob Kennedy
2009-12-07 05:54:04
A:
From MSDN
Remarks
Because ShellExecute can delegate execution to Shell extensions (data sources, context menu handlers, verb implementations) that are activated using Component Object Model (COM), COM should be initialized before ShellExecute is called. Some Shell extensions require the COM single-threaded apartment (STA) type. In that case, COM should be initialized as shown here:
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
And as Ken Lange alread suggested, deppending on what you want to execute, you may need administrative rights.
Cesar Romero
2009-12-07 02:57:57
Even so, the use that Sebastian intends should not require COM at all. In fact, it doesn't require ShellExecute. CreateProcess is a much better function for executing a known program, such as the updating program.
Rob Kennedy
2009-12-07 05:56:18