In corporate environments you usually cannot change your screensaver timeout/desktop locking timeout. In case you have some application, that should be running with the screen off (like media player, Flash presentation etc.) you might ask how to prevent the screen from locking.
And here's a program that does it for you: MouseMoving program. It actually doesn't move the mouse, it sends a message to the input queue, that the mouse is in the same position, thus non disrupting your mouse movements while working.
#define WIN32_LEAN_AND_MEAN
#define WINWER 0x0610
#define _WIN32_WINNT 0x0610
#include <windows.h>
int main(void)
{
INPUT i;
while (1)
{
i.type = INPUT_MOUSE;
i.mi.dx = 0;
i.mi.dy = 0;
i.mi.mouseData = 0;
i.mi.dwFlags = (MOUSEEVENTF_MOVE || MOUSEEVENTF_ABSOLUTE);
i.mi.time = 0;
i.mi.dwExtraInfo = GetMessageExtraInfo();
SendInput(1, &i, sizeof(i));
Sleep(1000);
}
return 0;
}
For convenience binary version follows mousemove.zip (6.5 kB)
I found this utility really useful when I had to connect to a remote computer via VNC. I started the TightVNC server on the computer, but I had to come back to the computer in couple of hours. When VNC is not running as a service (and here it wasn't, I had no admin rights to that computer), you can't unlock the computer. So I started the mousemoving utility, which prevented the computer from locking and could connect happily in couple of hours back.
It's of course a completely wrong answer to completely wrong question. The program, that should be running undisrupted should be handling the WM_SYSCOMMAND notification and react to SC_MONITORPOWER/SC_SCREENSAVE messages. However according to MSDN article on WM_SYSCOMMAND:
Microsoft Windows Vista and later: If password protection is enabled by policy, the screen saver is started regardless of what an application does with the SC_SCREENSAVE notification—even if fails to pass it to DefWindowProc.
Currently I have no Vista machine to try it out, so the mousemoving application seemed like a better idea, however the article on SendInput says:
Microsoft Windows Vista. This function is subject to UIPI. Applications are permitted to inject input only into applications that are at an equal or lesser integrity level.
So maybe not even the MouseMove program will work in Windows Vista, I can't really tell without trying it out. You Vista users out there, please send a comment.
Obligatory thanks to Mark James for creating the amazing Silk icons.
2 comments:
how do we remove dis utility??
Thanks a lot for the application. It helps us a lot while watching movies on laptops on which we can not change settings.
Post a Comment