Embedding a screen saver in a .net container control.

I have been experimenting with a simple means of embedding a screensaver into a control:

private void button1_Click(object sender, EventArgs e)
{
EmbedScr(@”c:windowssystem32ssmyst.scr”, panel1.Handle);
}
private void EmbedScr(string filename, IntPtr Handle)
{
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = “cmd.exe”;
psi.Arguments = string.Format(@”/c “”{0} /p {1}”””, filename, panel1.Handle);
psi.WindowStyle = ProcessWindowStyle.Hidden;
System.Diagnostics.Process.Start(psi);
}

This allows for dynamic decoration of controls allowing a ui to become very different very quickly. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s