Archive for April, 2009

Launching and Viewing Processes in C#

You can launch a new process from a C# application by using the Process class located in the System.Diagnostics namespace. The Process class also allows you to obtain a collection of all running processes on the system. How to Launch a New Process Starting a process is really easy. Process.Start( "Notepad.exe" ); And that’s it. [...]

April 15, 2009 · crow · 2 Comments
Posted in: C#, Programming

How To Get Screen Shot Capture in C#

It’s often necessary to programmatically get a screen shot of the desktop and save it to a file. This is pretty easy with C#; we can create a simple method that will save an image of whatever is on the screen or desktop. Saving a Bitmap Image of the Screen First make sure you include [...]

April 13, 2009 · crow · 11 Comments
Posted in: C#, Programming

Introduction to Multithreading in C#

This article is a very basic introductory tutorial for using multiple threads in C#. I’ll explain what threads are, why you would want to use them, and how to use them. I’ll also show you several examples for creating threads, killing threads, etc. What’s a Thread? A computer program is generally very linear. That is, [...]

April 8, 2009 · crow · 2 Comments
Posted in: C#, Programming

C# – Dynamically Invoke Web Service At Runtime

Web services have become an integral part of the communications between software over a network. There are a lot of ugly details behind how they work but thankfully C# hide a lot of those gory details. What you need to know is that there is a web service description (WSDL) that describes the available services [...]

April 8, 2009 · crow · 78 Comments
Posted in: Programming

Playing an MP3 or WAV File in C#

Playing an audio file such as an MP3 or WAV is incredibly easy in C#. For WAV files you can use the SoundPlayer class found in the System.Media namespace. Playing an MP3 will require referencing the Windows Media Player COM component. How to Play a WAV file To play the WAV file simply create a [...]

April 5, 2009 · crow · 14 Comments
Posted in: C#

How To Extract A Zip File With C#

The .Net Framework Class Libraries are great and allow you to manipulate many different file formats. Unfortunately they seemed to have left out support for standard Zip files. Thankfully our good friends over at ICSharpCode have released an awesome little library for handling Zip files called the SharpZipLib. The library is very simple to use [...]

April 3, 2009 · crow · One Comment
Posted in: General

Documentation Template Via Visual Studio Macro

Consistency is the key when working on computer software, especially if you are developing a large system with multiple programmers. You should be consistent with the layout and format of your source code. Unfortunately this can be difficult to achieve when time is precious – and isn’t it always. However Visual Studios macro system makes [...]

April 2, 2009 · crow · 4 Comments
Posted in: General

C# – Auto Increment Assembly Version Number

Auto increment assembly build numbers based on date within .Net.

April 1, 2009 · crow · 7 Comments
Posted in: Programming