Skip to content

Fun C# Cuckoo Clock

Good Morning All! (At least here in Aus)

Today I’d like to share with you an off topic, fun application I put together from inspiration I got off a StackOverflow.com thread entitled What’s Your Favorite Harmless Computer Practical Joke?. If you click this link you’ll jump right to the prank I’m talking about.

Basically Martin stated:

My all time favourite was a small application I wrote and installed on a colleagues computer.

It silently ran in the background and chimed every hour by opening and closing the CD tray and playing a “cuckoo” sound.

Effectively turning their PC into a cuckoo clock.

I thought, that’s brilliant!! He offered the source code, but alas, it was an old VB6 app and when I ported it to C# it no longer functioned (few bad references and then the CD-ROM door did not actually open).

So I started with a clean slate, ported what I could, included the ingenious tricky mechanism for storing the in-memory “Cuckoo” clock sound effect and re-wrote the code for opening the CD-ROM/DVD-ROM drive doors (yes doors, if you have multiple drives on the hour your computer is going to look like it’s doing the mexican wave). It turned out great and I really wanted to share it with everyone!

I take absolutely no credit for the design concept, that’s all Martin but I want to thank him for inspiring me to revive such a simple fun project.

Features:

  • “Cuckoo Clock” sequence, press Start and on the hour your CD-ROM/DVD-ROM drive will open, chime a “cuckoo” sound the number of times since 12am/pm and close the drive door. (I found doing it the traditional way, that is, open, chime, close, open, chime, close etc. wasn’t as effective as it was taking too much time to spin up and spin down the drive, even with no cd, I find this way sounds better anyway!)
  • Resident mode: Press “stealth” to re-create Martin’s dream (lol) which will hide the program to the tray ready for it’s unsuspecting victim (I recommend renaming the .exe to something like taskhost.exe, or another in-built windows process for maximum effect and hair-pulling). Note: kill process is the only way to close.
  • Supports minimising to the system tray.
  • Supports “tickle the bird” feature allowing you to perform a test drill and make sure the cuckoo clock is doing what it should do! (This will only chime once.)
  • About dialog.

It’s licensed under the Microsoft Public License (MS-PL) and is open to tinkering of any kind, just give credit where credit’s due.

Love to see any new features you could come up with for it!

VN:F [1.9.1_1087]
Rating: 4.8/5 (8 votes cast)
VN:F [1.9.1_1087]
Rating: +5 (from 7 votes)
Fun C# Cuckoo Clock, 4.8 out of 5 based on 8 ratings
Bookmark and Share
kick it on DotNetKicks.com
Shout it

NOW, FOR A WORD FROM OUR SPONSORS

8 Comments

  1. nice work.
    And the PlaySound pinvoke is interesting.

    VA:F [1.9.1_1087]
    Rating: 3.0/5 (2 votes cast)
    VA:F [1.9.1_1087]
    Rating: 0 (from 2 votes)
    Posted on 23-Aug-09 at 11:23 pm | Permalink
  2. it doesnt work any more :(
    application failed to initialize properly 0xc0000135
    running on windows xp

    VA:F [1.9.1_1087]
    Rating: 5.0/5 (2 votes cast)
    VA:F [1.9.1_1087]
    Rating: +2 (from 2 votes)
    Posted on 25-Aug-09 at 6:36 am | Permalink
  3. Awesome little app, great fun. Will definitely test this one out ‘in the field’ tomorrow.

    If you ever decide to revise it, I think a cool feature would be the ability to start it via the command line; cuckooclock.exe -s. That would make for some awesome unattended PC terrorism.

    Either way, great work! :smile:

    VA:F [1.9.1_1087]
    Rating: 3.0/5 (2 votes cast)
    VA:F [1.9.1_1087]
    Rating: 0 (from 2 votes)
    Posted on 12-Sep-09 at 8:29 am | Permalink
  4. Ed Smiley

    My favorite was a tiny St. Patrick’s Day application I wrote called green.exe. It turned your background system color green on a Windows machine.

    VA:F [1.9.1_1087]
    Rating: 4.0/5 (1 vote cast)
    VA:F [1.9.1_1087]
    Rating: 0 (from 0 votes)
    Posted on 31-Mar-10 at 3:38 pm | Permalink
  5. Mike

    The stealth doesn’t work properly, otherwise it’s great fun

    VA:F [1.9.1_1087]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.1_1087]
    Rating: 0 (from 0 votes)
    Posted on 01-Jul-10 at 6:03 am | Permalink
  6. Steven

    solomongaby: Might help if you’re not running it on a ~10 year old platform.

    VA:F [1.9.1_1087]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.1_1087]
    Rating: 0 (from 0 votes)
    Posted on 01-Jul-10 at 3:58 pm | Permalink
  7. Ismail

    Excellent, just one thing. Can it hide without showing up even as a task bar icon? If it should work like that, then its not working on windows 7

    VA:F [1.9.1_1087]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.1_1087]
    Rating: 0 (from 0 votes)
    Posted on 28-Jul-10 at 7:47 pm | Permalink
  8. joe

    solomongaby iz teh BONEHEAD :twisted:

    VA:F [1.9.1_1087]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.1_1087]
    Rating: 0 (from 0 votes)
    Posted on 04-Aug-10 at 3:23 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*
My name is Graham O'Neale and I'm a software architect from Gold Coast, Australia. I am an overtime thinker, full time coder and awake part time in the real world. I have a keen interest in software development, particularly in the realm of programming (C#, ASP.NET, ASP.NET MVC, LINQ (2 SQL), Entity Framework, Silverlight, Blend, WCF, WPF) and a keen interest in the cutting edge and innovation. I have a new found love for design patterns, ALT.NET practices and well crafted software architecture. The purpose of this blog is to express any thoughts, findings, tips and gripes along my travels in the wonderful world of coding and technology...