starting a process as a different user or getting FindWindow() to see other users' windows?

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
I need to either get php to run a program as a different user or get a C++ program to return the window title of a process running as a different user. Is either one possible? If I not, can a C++ program launch another program as a different user?
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
(This also explains the problem from your other thread)

Services are not allowed to access the Desktop (by default). That's why FindWindow() is failing. There are ways to get around this problem, but I don't know much about Services.

My suggestion to you is this: Create a separate program that opens up a server socket (make it so that it will only accept connections from the local machine, so there would be no security issues). This program will run using the regular user on the Default Desktop. Now the second program executed by your PHP code will connect to this server and simply ask it to return the information you desire. That will solve your problems.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Yup, after a while I figured that out. I think the best solution would be to write a winamp plugin that I run that just puts the current song title into a file, then read that file from the PHP.