06-28-2019 03:55 PM - edited 06-28-2019 03:59 PM
Depends where you see 42! The VI is so programmed that if ShellExecute returns a value smaller or equal to 32, it will return an error 42 in the error cluster and a string "ShellExecute error xx" where xx is a number that is the value returned from the ShellExecute function.
So if ShellExecute returns 42 everything is fine. But if the VI returns error 42 I would like to know the xx value in the error string. And yes 0 return value from ShellExecute would indicate out of memory condition during execution of ShellExecute.
06-28-2019 04:01 PM
Yes! The 42 is coming back from the Call Library node directly, it is not the 42 you are inserting if Call Library returns ..32.
How inconsistent to use 0 for an error condition!
06-28-2019 04:10 PM
@FermWorks wrote:
How inconsistent to use 0 for an error condition!
That's for historical reasons. In Windows 3.1 the function did return a HINSTANCE value which was a handle that could be used to access the spawned process. Since this value could be almost any possible value the developers reserved the value range from 0 to 32 for some error codes and anything above was a HINSTANCE. Currently the function returns still the error codes range when something goes wrong, but not really a HINSTANCE that could be used to identify the child process. Instead it simply is documented to return a value that is higher than 32 but which can not be used for anything else.
07-23-2019 07:56 PM
Hi Rolf
Thanks for putting together the VI with the CLFN in it. That's gotten me most of the way to what I was looking for. I need the "wait until complete" functionality and took your advice to start looking into ShellExecuteExA... and I gave up. I might give it a try again later and if I do I'll post my solution.
Thanks again.