Most of us here use Pandora for the listening to the music with their headphones.

The keyboards we have at the office do not have any sound volume adjusting keys.

It’s mildly annoying that you need to take off your headphones every time someone talks to you or click the system tray every time the musinc is too quiet or too loud. But hey! What do we have CodeProject and Visual Studio for?

Quick investigation on CP allows to determine that there is a way for a DotNet app to both control the system volume and hook the keyboard events fairly easily.

Half an hour later…

We have a little tray application for adjusting the system volume control

The only visual indication of the app running is a tray icon. While it is running you can:

  • Ctrl + Alt + Up Arrow – Volume up
  • Ctrl + Alt + Down Arrow – Volume down
  • Ctrl + Alt + Scroll Lock – Mute / Unmute
  • Click the icon to het a baloon tooltim with those hints
  • Right click the tray icon to close the app.

The icon has been taken from the Dement?con icon pack by MindlessPuppet.

Posted in .Net Framework, C#, Downloadable
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 3 Comments »

UpTime.Net

PerformanceCounter pc = new PerformanceCounter(“System”,
    “System Up Time”);

 

//Normally starts with zero. do Next Value always.

pc.NextValue();

TimeSpan ts = TimeSpan.FromSeconds(pc.NextValue());

MessageBox.Show(Environment.MachineName +

    ” has been up for \n\n” +

    (ts.Days < 1 ? “” : ts.Days + ” days, “) +

    (ts.Hours < 1 ? “” : ts.Hours + ” hours, “) +

    (ts.Minutes < 1 ? “” : ts.Minutes + ” minutes “) +

    ” and “ + ts.Seconds + ” seconds.”);

Nice, neat and simple.

Get a compiled executable here

Posted in .Net Framework, C#, Downloadable
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 30 Comments »

How to get Website Thumbnail in C#

[Edit: I’ve posted it on CodeProject and there are some greatl people commenting on it that did the investigation on ho to wrap it in a STA Thread and make it a part of your ASP.Net solution – really cool stuff!]

An interesting use case. Darek (our beloved sys admin – we all bow to him and worship his skills) has recently asked if it?s possible to write a .net application to make a thumbnail of a website. Which is pretty trivial with Windows forms actually.

All you really need to do is drop a WebBrowser on your form and once it?s loaded the page call:

webBrowser.DrawToBitmap(bitmap, bitmapRect);

When it gets tricky is when you want to do it in a console application is a way that can take a shot of multitude of websites provided in a batch file. There is a dirty way of instantiating a whole form, making it show (or not), doing the work and then exiting the Winforms app. Which might probably be enough for a quick solution, but I wanted to publish this piece of code, so I would actually NOT take a pride in something like that.

How is it done the proper way then? Read the rest of this article »

Posted in .Net Framework, C#, Downloadable, Software Development, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 4.29 out of 5)
Loading...
| 150 Comments »

How dare you, touch my alpha channel!

Why can’t graphic applications get their channels right?

Originally posted on Wincustomize.com

[Updated 11 May 2005] Read at the end of the article.

I’ve been on a quest to improve a skin today and to do so I needed to extract a big archive in a proprietary and not widely supported format and get the images out of it and into the skin. Turned out the first part was not as bad as I expected as I’ve found some tools on the net to do this and Kris helped with the tool to convert the images in the proprietary format into TGA’s. Now here’s where the pain begun.

I needed to have my alpha channel kept in the files but I also wanted to process the files before making them into the skin.

Read the rest of this article »