Why does CreateProcess give error 193 (%1 is not a valid Win32 app)

后端 未结 4 1197
花落未央
花落未央 2020-11-28 16:13

The code below fails to start documents. I get error 193 (%1 is not a valid Win32 app). Starting executables work fine. The files are properly associated, they start the cor

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 16:56

    The most likely explanations for that error are:

    1. The file you are attempting to load is not an executable file. CreateProcess requires you to provide an executable file. If you wish to be able to open any file with its associated application then you need ShellExecute rather than CreateProcess.
    2. There is a problem loading one of the dependencies of the executable, i.e. the DLLs that are linked to the executable. The most common reason for that is a mismatch between a 32 bit executable and a 64 bit DLL, or vice versa. To investigate, use Dependency Walker's profile mode to check exactly what is going wrong.

    Reading down to the bottom of the code, I can see that the problem is number 1.

提交回复
热议问题