473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Messing with duel monitor screensaver

I am in the learning fazes of writing a c# screensaver that will take
into account a second monitor. the basic code I have has a problem and
i am not sure what it might be. What it is doiing is executing on the
primary screen and on that instance Close(); launches on the second
screen.
the code is:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Drawing;
using System.Windows.Forms;

namespace InfoSaver
{
public class InfoSaver : System.Windows.Forms.Form
{
// private System.ComponentModel.IContainer components;
private Point MouseXY;
private int ScreenNumber;

public InfoSaver(int scrn)
{
InitializeComponent();
ScreenNumber = scrn;
}

protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}

private void InfoSaver_Load(object sender, System.EventArgs e)
{
this.Bounds = Screen.AllScreens[ScreenNumber].Bounds;
Cursor.Hide();
TopMost = true;
}

private void OnMouseEvent(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if (!MouseXY.IsEmpty)
{
if (MouseXY != new Point(e.X, e.Y))
Close();
if (e.Clicks 0)
Close();
}
MouseXY = new Point(e.X, e.Y);
}

private void InfoSaver_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
Close();
}

#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()
{
//
// ScreenSaverForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.FromArgb(0,0,102);
this.ClientSize = new System.Drawing.Size(292, 273);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "ScreenSaverForm";
this.Text = "ScreenSaver";
this.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.InfoSave r_KeyDown);
this.MouseDown += new
System.Windows.Forms.MouseEventHandler(this.OnMous eEvent);
this.Load += new System.EventHandler(this.InfoSaver_Load);
this.MouseMove += new
System.Windows.Forms.MouseEventHandler(this.OnMous eEvent);

}
#endregion
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and the last page is:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Windows.Forms;

namespace InfoSaverF
{
public class DotNETScreenSaver
{
[STAThread]
static void Main(string[] args)
{
if (args.Length 0)
{
if (args[0].ToLower().Trim().Substring(0,2) == "/c")
{
MessageBox.Show("This Screen Saver has no options you can set.",
".NET Screen Saver", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else if (args[0].ToLower() == "/s")
{
for (int i = Screen.AllScreens.GetLowerBound(0); i <=
Screen.AllScreens.GetUpperBound(0); i++)
System.Windows.Forms.Application.Run(new
InfoSaver.InfoSaver(i));
}
}
else
{
for (int i = Screen.AllScreens.GetLowerBound(0); i <=
Screen.AllScreens.GetUpperBound(0); i++)
System.Windows.Forms.Application.Run(new
InfoSaver.InfoSaver(i));
}
}
}
}

Jul 28 '06 #1
0 1695

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bathroom_Monkey | last post by:
Hi, I am building some php script that will backup a mysql database and store it locally. This script will be run on a spare computer I have in my office. I want the results of the backup to be...
1
by: klappnase | last post by:
Hello everyone, does anyone know a way to stop the screensaver under linux from starting up while a certain process is running? I need this because I experience a memory leak while recording...
0
by: Luke | last post by:
I am trying to capture an event when the screensaver starts. I have code working on Windows XP etc when the Password/Welcome Screen is enabled . Using the Fast User Switching Notifications. ...
2
by: DanielB | last post by:
Does anyone know what the command line argumentto launch a screensaver's options/configuration dialog is on Windows XP Pro? From most of the example source code I can find on the web, it would...
0
by: Paul Smith | last post by:
I have been given an unusual task to create a Windows Service to do something periodically to make the screensaver timer reset. We have a general policy of locking computers automatically after 10...
4
by: Paul Smith | last post by:
I have been given an unusual task to create a Windows Service to do something periodically to make the screensaver timer reset. We have a general policy of locking computers automatically after 10...
4
by: Simon Mercer | last post by:
I have been trying to build a screensaver that will connect to a database and display specific data depending on the user that is logged in. I have managed to get a simple data access screensaver...
3
by: kalyanilovesme | last post by:
Hi, I am running my application in two minitors.In one monitor.............if it is idle for some time the screensaver wil come(I wrote the code for this using system dll functions) . Now my...
0
by: Ed | last post by:
I want to know when the screensaver has kicked in on my monitor so that I can turn off the desk light in my office. Under XP it has worked great. I use the following to check if screensaver is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.