Originally Posted by
MSDN
Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. The following table lists the error values. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Windows applications. It is not a true HINSTANCE, however. The only thing that can be done with the returned HINSTANCE is to cast it to an int and compare it with the value 32 or one of the error codes below.
You need to cast the return value to an int before doing the comparison. In addition, your comparison returns success for the error value of 32.
Code:
if( (int) ShellExecute(NULL, "open",
popupPath,
NULL, NULL, SW_SHOWNORMAL) <= 32)
{
printf("Error...\n");
}
else
{
printf("Ok..\n");
}