I am currently writing an application which uses lowlevel mouse hooks. Because I have to start the application with the system with administrator privileges I wanted to create a service(see here: Is this a practical use of a service?). Now I've just found out that a service is not able use hook mouse-hooks. So I need a new concept but I really don't know where to start. I've already tried it with a simple process but I was not able to use the task scheduler to run it as administrator on system start.
So what would recommend to use? Should I still use a Windows Service to start a process? Isn't that a bit overkill?
EDIT: I've just tried to start my process which performs the hook out of the service. The process starts but it seems like, it behaves the same as a simple service behaves. I can install the hook but the callback does not gets called. I am starting the process with this code:
STARTUPINFO info={sizeof(info)};
PROCESS_INFORMATION processInfo;
if (!CreateProcess(path, NULL, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
{
std::wstring msg(L"Could not start \"");
msg.append(path);
msg.append(L"\". CreateProcess");
WriteErrorLogEntry((PWSTR)msg.c_str());
return;
}
How can I solve my problem? The process has to run with administrator rights but needs another context?