Run ShellExecute

When I run this, command window shows up and lngErr = 42

lngErr = ShellExecute(0, "runas", "cmd.exe", "", "", 3)

But when I run this, nothing happend and lngErr = 2

lngErr = ShellExecute(0, "runas", "compmgmt", "", "", 3)

Any suggustion? Thanks

July 17th, 2013 3:45pm

Hi,

Based on my research, if the function succeeds, it returns a value greater than 32. If the function fails, it returns an error value that indicates the cause of the failure.

Quote from:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx

So I think the first code seems to be successful.

And if you want further help, please post the case in Microsoft Office for Developers:
http://social.msdn.microsoft.com/Forums/en/category/officedev

Free Windows Admin Tool Kit Click here and download it now
July 18th, 2013 3:32am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics