views:

171

answers:

4

I don't really know where to begin. Let's start with the stupid questions:

What language should I use for this? What is suited for the task at hand?

Next, the real ones:

Is there a way to stop the screensaver from starting, short of changing the cursor position? If not, will changing the cursor position even work?

A: 
  1. Your program does not need to be visible in the task bar at all.
  2. You don't even need a program at all, if you can disable the screensaver in the registry.
  3. What you want to do can perhaps be achieved by sending a MOUSE_MOVE event to the desktop window. If you want to use C# (the only language I am current with right now), you can look at this article, but maybe a simple C program using the WinAPI is better suited for this task.
Treb
I believe the user wanted to only disable the screensaver while their application was running. And wants it in the system tray for easy access to turn on/off. I could be reading into it too much though.
Nate Bross
You are correct.
Nathan Lawrence
A: 

.NET will easily allow you to put an application in the system tray (checkout the NotifyIcon object in System.Windows.Forms.Controls).

I believe you can use the SetCursorPos (http://msdn.microsoft.com/en-us/library/ms648394(VS.85).aspx) API call to prevent the screen saver, just make sure you set them to the current location so you don't actually move the mouse.

Nate Bross
+7  A: 

SetThreadExecutionState will prevent the screensaver from coming on or the machine from automatically going to sleep if you pass the ES_CONTINUOUS and ES_DISPLAY_REQUIRED flags.

Michael
+1  A: 

I wrote an app awhile ago that does exactly what you are asking for. It runs as an icon in the System Tray, not the Taskbar, and uses a global message hook to disable the WM_SYSCOMMAND/SC_SCREENSAVE notification from reaching any applications. If that notification does not reach the DefWindowProc() function, the screen saver will never run.

Remy Lebeau - TeamB