Go Back   TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to simulate mouse movements to prevent screen saver activation?

Windows XP Support


Reply
 
Thread Tools Search this Thread
  #1  
Old 23-05-2008
Member
 
Join Date: Apr 2005
Posts: 36
How to simulate mouse movements to prevent screen saver activation?

Whenever the screesaver is active on the web we have to re-logon and re-type the password back again. This is simply weird. The settings are applied on all the computers. I am simply not able to figure out how to modify the same. Desktop should appear when someone movies the mouse and comes on the screen. But there the scenario is bit different. It just take the user to the logon screen. We are having a server here.

Reply With Quote
  #2  
Old 23-05-2008
Member
 
Join Date: Jul 2004
Posts: 129
I think that is not a issue. Here after the screen saver goes off you do not require to re-logon here. You just have to enter your password, which is very quick. The screen saver is applied with lock screen settings. You are not login in back again you are just unlocking your desktop. So that is simply configured to prevent user activity. While it may be possible to run a program that simulates user activity, it's probably not a good idea to install it.
Reply With Quote
  #3  
Old 24-05-2008
Member
 
Join Date: Sep 2005
Posts: 185
I had gone through an article somewhere that states if the mouse cursor is place on the Start Menu the screen saver would not start. I was just trying to find that settings. But somehow found nothing. I am having 5 computers on the network and I am the admin. I want some option here, where users can temporarily disable the screensaver for sometime. I am also using some third party tools here which can provide a limited set of rights to the users.
Reply With Quote
  #4  
Old 24-05-2008
Member
 
Join Date: Jul 2004
Posts: 135
Re: How to simulate mouse movements to prevent screen saver activation?

If you are logged in to the local account instead of domain then you might have rights to modify the settings of your own pc. Not for the user profiles which are stored on the server. First ask anyone from your IT department if they will permit you to change your own screensaver timeout. They may not make a per-account change to let the timeouts vary by account but they may not bar you from altering your own timeout.
Reply With Quote
  #5  
Old 24-05-2008
Member
 
Join Date: Sep 2005
Posts: 208
What are you trying to do actually. Do you want disable the screen saver completely or you are just trying to configure idle timeout. You are a bit confusing here. I am unable to understand your actual issue. I think you must simply try to play with group policy objects here which can help you more in fixing the problem. You can configure auto-logout settings here or ample of other things which might work really well.
Reply With Quote
  #6  
Old 13-11-2008
Member
 
Join Date: Nov 2008
Posts: 1
Wow, the naivety of the IT people really amuses me. Not everyone spends all day in word processors or spreadsheets typing all day. Today I was hit with the wonderful group policy hell that people on this and other threads are complaining about. I don't believe that my environment is unusual, I have several computers I work on and use remote desktop to switch from one to the other. I must have typed my password 100 times today. Thanks IT. That is all from my soapbox.

So given that I hate the situation as much, if not more than others I decided to write some code to get around it. What you need is a windows form, with a text box and a timer (the interval of the timer must be less than the policy setting). When the timer fires call teh timer function below:

namespace StopScreenSaver
{
public partial class Form1 : Form
{
[DllImport("User32.dll")]
private static extern int SetForegroundWindow(IntPtr hWnd);
[DllImport("User32.dll")]
private static extern IntPtr GetForegroundWindow();

public Form1()
{
InitializeComponent();
}

private void OnTimerExpired(object sender, EventArgs e)
{
IntPtr previous = GetForegroundWindow();
SetForegroundWindow(this.Handle);
textBox1.Text = "";
SendKeys.Send("a");
SetForegroundWindow(previous);
}
}
}

Enjoy

Leave optical mouse on top of a small analogue alarm clock with a second hand.
Reply With Quote
  #7  
Old 10-01-2009
Member
 
Join Date: Jan 2009
Posts: 1
Re: How to simulate mouse movements to prevent screen saver activation?

Great job! I agree 100% - the bonehead administrators have no clue about the work life of average developers. I too work with at least 2 computers, sometimes 3 or 4. Besides which, a single call or meeting will activate all the screen savers.

I needed to use this tool while working remotely for a client of mine who has this stupid policy (and refused to change it). Our Gotomeeting session kept timing out and no-one was around to re-activate the screen. Bingo.. just run the keepalive program and the problem is solved.

I took the code and compiled it using .net 2.0 framework... works great.

Here is the main Form1.Cs file if anyone wants to do the same

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace KeepAlive
{

public partial class Form1 : Form
{

[DllImport("User32.dll")]
private static extern int SetForegroundWindow(IntPtr hWnd);
[DllImport("User32.dll")]
private static extern IntPtr GetForegroundWindow();

public Form1()
{
InitializeComponent();
}

private void timer1_Tick(object sender, EventArgs e)
{
IntPtr previous = GetForegroundWindow();
SetForegroundWindow(this.Handle);
textBox1.Text = "";
SendKeys.Send("a");
SetForegroundWindow(previous);
}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}

here is the Form1.designer.cs file.. 100 secs on the timer.

namespace KeepAlive
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.textBox1 = new System.Windows.Forms.TextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(1, 4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(28, 20);
this.textBox1.TabIndex = 0;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 100000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(39, 27);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Admin";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Timer timer1;
}
}
Reply With Quote
  #8  
Old 23-01-2010
Member
 
Join Date: Jan 2010
Posts: 1
There seems to be an odd tendency to respond to this request by passing judgment on the desire to do it and suggesting simply not to. Which I'm sure is a very helpful response for an idiot without the sense to know what screensavers are for, or someone who actually needs some coaching on the work habits he should use in doing his job. But let me satisfy the jury by justifying my need first: I telecommute full time for a very large corporation, work from my desk at home. Policies require password screen saver, 10 minutes, and automatic security tool runs routinely to ensure compliance, sending a nasty gram to my manager if I turn it off. Since there is never another human in my home while I'm working, there is absolutely zero chance that the security of my computer will be compromised by lack of screenlock password. It serves no purpose other than as a nuisance to me and to satisfy the dratted security tool. It seems security policies like this are often put in place and enforced universally, even for those with special circumstances that make the policies unnecessary.

Does that satisfy the jury that I've given proper respect to the issue of security? Now my work habits--some days I keep my hands on keyboard all day long and screen saver never comes on. Other days, I work across the room sitting at my other desk, and I can glance over at my screen now and then to see if there are any new requests for me to handle or any blinking chat messages signalling someone wants to speak to me. Screen saver comes on, can't see the screen anymore, plus the annoyance of having to get up and go do the password again. So you see, I may need the screen to be viewable for longer than 10 minutes without touching the mouse or keyboard--and not because I'm watching videos.

Would one of you be kind enough to explain exactly how I can implement the code given here? Explain it like you're talking to a small child with a degree in computer science. Never did any programming in Windows before.

I must say that some people are quite arrogant and it's a shame that people must be so derogatory when people ask for help. If you don't have a solution just move on rather than cast judgement.

My problem is that there are applications on my work laptop that must remain active in case I get a message. however the laptop isn't powerful enough or large enough for me to do my graphics editing when working from home. So I use a 2nd laptop with larger screen that is more powerful. I edit one image on my home laptop and the other goes into standby making it appear as though i'm offline.

So please make an effort to understand others situations and the forums wil be happier more helpful places.
Reply With Quote
  #9  
Old 15-07-2010
Member
 
Join Date: Sep 2004
Posts: 208
Re: How to simulate mouse movements to prevent screen saver activation?

I have the same problem here at work. My WinXP SP3 laptop locks itself (as if pressing Win+L) after about 15 minutes of inactivity. The irony is that I need to watch presentations that take more than 15 minutes, or I'm in online meetings where there's no need for mouse/keyboard and it pisses me off that the screen locks.

So I wrote a small Perl script to simulate mouse movement:

PHP Code:
use strict;
use 
Win32::GUI();

my ($x$y) = Win32::GUI::GetCursorPos;

while(
1) {
    print 
"Shake it baby\n";
    
Win32::GUI::SetCursorPos($x+1$y);
    
sleep 1;
    
Win32::GUI::SetCursorPos($x$y);
    
sleep 10*60;

The script works and I see the mouse move, but that doesn't prevent the lock screen from activating. Does anyone know of a free software that would disable this behavior?

UPDATE: I found that if I have WinSCP 4.2.7 attempt to connect to an unreachable host, the screen never locks. I posted on their forum to find out why this happens and I asked the author to extract that functionality into a small utility to prevent screen saver activation.
Reply With Quote
  #10  
Old 23-07-2010
Member
 
Join Date: Jul 2010
Posts: 1
Re: How to simulate mouse movements to prevent screen saver activation?

You guys are lucky. I work at the stupidest fuking company* in the world. My timeout is set to 3 minutes. So if I am holding still reading something, my screen locks, and I have to re-enter my password. Fuking distracting!
Reply With Quote
  #11  
Old 22-03-2011
marlogger
 
Posts: n/a
Re: How to simulate mouse movements to prevent screen saver activation?

Hi ,
I have been working on similar tool, the only way that made it work is to use SendInput function in Win32 API. Then P/Invoke it from .NET The tool is available as a binary if you want to download it from my blog.
Regards,
Mike
Reply With Quote
  #12  
Old 08-09-2011
Member
 
Join Date: Sep 2011
Posts: 1
Re: How to simulate mouse movements to prevent screen saver activation?

Or go to murgee.com, download, run (doesn't install so no admin needed), pay $5 and go on with your life.
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to simulate mouse movements to prevent screen saver activation?"
Thread Thread Starter Forum Replies Last Post
Controlling Windows with the mouse movements fumble Guides & Tutorials 5 13-05-2009 12:14 PM
screen saver does not start Abhav Customize Desktop 4 02-02-2009 11:33 PM
How to set screen saver in Ubuntu 7.04? Agilent Customize Desktop 1 08-08-2008 01:09 PM
Vista screen saver Jack P Vista Setup and Install 2 30-11-2007 04:50 AM
screen saver freezes bronwyn Vista Help 3 05-04-2007 01:05 AM


All times are GMT +5.5. The time now is 05:48 PM.