Tag Archives: Windows

Delete files quickly and easily in C#

A while ago, I needed to delete files that were created when I opened old projects in a newer version of Visual Studio. LOTS of files. (As far as I know, there’s no way to tell Visual Studio not to … Continue reading

Posted in files, system | Tagged , , , , , , , , , , | Leave a comment

Get the computer’s operating system in C#

This example uses the following code to display the operating system version when it starts. private void Form1_Load(object sender, EventArgs e) { OperatingSystem os_info = System.Environment.OSVersion; lblOs.Text = os_info.VersionString + “\n\nWindows ” + GetOsName(os_info); } This example simply gets the … Continue reading

Posted in system | Tagged , , , , , , , , , | Leave a comment

Suspend or hibernate the system in C#

The Application.SetSuspendState method lets an application make the system suspend or hibernate. A suspended system enters a low power mode. A hibernating system saves its memory contents to disk and then enters low power mode. Because it doesn’t need to … Continue reading

Posted in system | Tagged , , , , , , , , , , , , | Leave a comment

Hints for beginners without sacrificing efficiency

In my previous post, The ribbon interface: sacrificing usability for discoverability, I explain that the ribbon interface makes it easier for beginners to wander through an application’s features to discover what tools are available but that it makes it harder … Continue reading

Posted in miscellany, tips, user interface, Windows Forms programming | Tagged , , , , , , , , , , , , | Leave a comment

The ribbon interface: sacrificing usability for discoverability

Unlike my usual examples, this post is a discussion of an important design technique: providing information for beginners without sacrificing efficiency for more experienced users. Next time I’ll post a follow-up and then get back to examples after that. In … Continue reading

Posted in miscellany, tips, user interface, Windows Forms programming | Tagged , , , , , , , , , , , , | 2 Comments

Close Mozilla Firefox popups in C#

Some browser tools try to block advertising popups, but lately some have been sneaking through on my system so I wrote this program to close Firefox popups when they appear. Start Firefox and create the windows that you want. Then … Continue reading

Posted in API, system | Tagged , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

List desktop windows in C#

This program uses several API functions to list the windows running on the system’s desktop. To make reusing the code easier, I made the key routines static in a static class so you don’t need to instantiate the class to … Continue reading

Posted in API, system | Tagged , , , , , , , , , , | 1 Comment

Make Windows shutdown, reboot, log off, lock, hibernate, and sleep in C#

This example shows how a C# program can make Windows shutdown, reboot, lock, log off, or hibernate. Some of those operations require you to use methods defined in external libraries, so the code uses DllImport attributes to define them. DllImport … Continue reading

Posted in miscellany, system | Tagged , , , , , , , , , , , , , , , , | Leave a comment