Question

If I use C++ Windows API "CreateProcess" or C run-time library "system" to launch most processes, they run fine. But if I use the same to launch openfiles.exe as in "openfiles.exe /query" under Windows 7 and 8 it never works. It complains about needing a 32-bit OS to be running, or, if I elevate it with runas, I get Invalid Function. There is definitely something peculiar about openfiles.exe under Win 7 and 8, and, despite it working fine from a command prompt, it never runs when launched by another process. Why?

Was it helpful?

Solution

It seems under Windows 64 bit, the application must be also 64 bit one (not sure for 32 bit OS).

My system is Windows 7 64 bit and if I build my app with "Target Platform" set to "64-bit Windows", the following works.

::ShellExecuteW( this->Handle, NULL, L"openfiles.exe", L"/query", NULL, SW_SHOWNORMAL );

I believe other launching options also would work like CreateProcess.

But gives the same error you when built as 32-bit application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top