开发者

Windows API function FindWindow returns always 0 when exe is executed within PHP exec() function

I have made a command line app to do some tasks on the server. For example, it 'tracks' a window and send keys to it. I use the windows API function findWindow() to find the window. When i run the exe from the command line i开发者_Python百科t is working great except when i run it from PHP with the exec() function. The FindWindow function returning always 0 (it cannot find a window handle), why? Is it running in a sandbox or something?

What can i do about this? Anyone?

Thank you for your answer.

Kind regards, Erwin Haantjes


Services do not have the ability to find windows in the foreground user session. This is called session-0 isolation.

PHP runs under the web server which is (usually) running as a service, in a particular session/context. Because of this, your findWindows() function will fail.

You can test this theory by calling PHP.exe to run your script from your own session's command line.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜