Today I upgraded to Wordpress 2.3.x, as well as making it registered in Dreamhosts OneClickInstaller. The downside to that is that things got moved around, so a few plugins are broken, but more importantly content is broken.
I'll work at fixing up content, but you may have to bear with me for a few days/weeks.
Update: Adding plugins back in, added a 'close posts after 14 days' to stop the spam I've been getting.
No Comments
edit: weird wordpress error made this private rather than published, oops.
Given I'm now a MSP who isn't able to do the usual running of sessions, I thought I'd write some blog posts aimed at sharing code/techniques to achieve some coolish things. The first of which will cover how I set the custom status in Windows Live Messenger.
Requirements
- Windows Live Messenger (v8+ should work) with "Show What I'm Listening To" enabled
- Visual Studio (C# Express or greater)
Introduction
Windows Live Messenger (WLM) has the ability to set status messages in two forms, "Personally Messages" (PSMs) where the user sets their status themselves, or "Now Playing" (NPM) messages which can be set programmatically and will be the the focus of this article. While you can set PSMs programmatically, it isn't nearly as interesting, and has some side effects (such as overwriting the original PSM).
Windows Media Player has a "Now Playing" plugin which sets the NPM to the song currently being played. Similar plugins exist for other media players such as WinAMP. There are other uses, such as letting friends know what games you're playing.
How it works

WLM "listens" to Dynamic Data Exchanges over the Windows Messaging Layer; that is, external programs (or addins) pass a message to WLM which then sets the status itself. There isn't a specific managed method for DDE, so Platform Invoke (P/Invoke) is needed. PInvoke allows you to call unmanaged functions within managed code. If you haven't specifically used PInvoke before, it can look a little weird, so here's an example
using System.Runtime.InteropServices;
[DllImport("user32.dll", SetLastError = true)]
private static extern int FindWindow(String lpClassName, String lpWindowName);
This would then allow us to use the function FindWindow from the user32.dll. Our little application uses functions from User32.dll, FindWindow, FindWindowEx, and SendMessage. FindWindowEx finds the WLM "Window" so it know where to send the message, and SendMessage (funnily enough) sends the message.
WLM requires a specific format of the, but within that format there is a bit of wriggle room. You get to send a "format" parameter, which can look like "I'm playing {0} by {1}" where {0} and {1} represent the next two parameters.
I've attached the source code, which includes a sample application, for changing the NPM message. It's all fairly straight forward so there really isn't much more I can write in this article.
Download
Credits
Notes
Lots of applications still use DDE despite it being "superseded" by other communication techniques. I'll come back to DDE in another article, and look at the alternatives.
No Comments
Thanks to encouragement from Nicholas Ellery, I'm now a Microsoft Student Partner, and I'll make a rather unusual one at that because of my health/study status - that is, I'm an off-campus student.
Long story short, I'm to help out Nick with Uni related competitions/etc from Microsoft, and generally try and replace Nick Hodge as a Professional Geek/Enthusiast Evangelist for Microsoft. In return I get some pretty cool stuff, on top of the benefits I'll get form having this on my resume.
- Flown to attend Tech.Ed
- Invited to various other Microsoft events
- A free MSDN subscription (valued at ~$4000)
- An MSDN Welcome pack
- Preferential treatment in recruiting for technical graduate roles at Microsoft
- To be part of the most fun group of people you ever met (seriously)
(source)
On a side note, my finger is still sore from where I mauled it, so the other posts I've been making lately have been just clearing out the backlog. I do have a few code examples/walk-through's lined up for when my finger heals and I can type without pain again.
3 Comments
WGS v0.3 was supposed to demonstrate the possibility of having in game chat (XFire's main feature) via notification of when you got a message in game (just a little overlay would popup). Unfortunately, I've not been able to get that to work, because I can't seem to load additional DLL's - signed or not - in WLM. The library I was playing to use to handle the overlays is Muhammad Haggag's DirectDrawOverlayLib, which is a managed wrapper around unmanaged code.
Unfortunately, when trying to execute the code (any of the code…in this case, just creating an object of one of its types) I get errors. Specifically, using VS2008 Beta 2 to attach to MSNMGR.exe to debug, I get
The type initializer for '<Module>' threw an exception.
The inner exception is:
{"Could not load file or assembly 'msvcm90, Version=9.0.20706.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0×80131417)":"msvcm90, Version=9.0.20706.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}
At the moment, my theory is that the unmanaged code is causing the issue. I was able to get a separate C# library ("hello, my name is test") to function. I'm guessing msvcm90 isn't in the GAC (since it has native code and all), so WLM is kicking up a fuss.
Unfortunately my attempts at removing the dependency on msvcm90 have so far been unsuccessful (they result in a few fatal errors), probably due to the nature of the library. If I can't get this to work, I'm in way over my head trying to get it to work using purely managed DirectX, so it'll cancel the project to some degree :(
When I discovered the performance hit in v0.1/0.2 because of WMI process watching, I decided I'd not release v0.3 until I'd fixed that at the very least. Unfortunately, I'm not really sure where to begin on that, so while it is on its way, it is being pushed onto the backburner for awhile.
1 Comment
A little known company called Valve released "The Orange Box" to the world a little while ago, and while it unarguably is a good value buy given the average game these days, I've been a little under whelmed by the actual content. This will probably be a series of posts broken up into each game.
Half-Life 2
Half-Life (1, the original, the first) was hailed as a break through in the First Person Shooter for it having a story line, a unique concept back in those days. For those who haven't played it (I didn't play it myself until the weeks before its sequel), the story can be found easily enough by searching for it, but I'll summarise it for the lazy
You're a physicist, Gordron Freeman, incapable of speech, hygiene (you never leave that suit), or actually doing physics, set to save the world after the Black Mesa research complex goes ape after a failed portal based research experiment. Since you've looked at guns before, you instantly know how to use them with better-than-military grade precision, and you have to save the world/your own ass by escaping Black Mesa.
But wait, there is more, once you do beat the impossible odds of battling Security Guards, Military Personal and random aliens, you'll teleport yourself to their planet, and beat the shit out of them, be 'liberated' by the "G-Man", and the games over. Congratulations.
In 1998/9, sure, story telling was weak in games because the budgets weren't there to hire non-geeks (ie, those who can write coherent sentences), and don't get me wrong, the game is fairly solid in gameplay and overall presentation - I just don't get why its hailed as the best thing to come out in the history of History.
Like all quality sequels, you start off where you were in the last game, except throw that into the HL universe and you start off in the nothingness which the G-Man left us in. Oh, and it's ten to twenty years in the future - you don't find out and official sources aren't sure. Once a company finds a good formula for making games/books/movies, they tend to stick to it, and Half-Life 2 is no different. You play Gordon Freeman, you wear a special suit, you don't talk, and you have to save the world.
There are some mind boggling changes to the game though. No longer do the evil aliens hail from the terrifying floating rocks called Xen, in fact some of them are even our new allies, for our new enemy is the Combine, who were behind the original invasion as-if-you-didn't-already-guess-that; Physics can now be handled by even the lowliest of physicists thanks to the Gravity Gun; and finally, Head Crab Zombies come in many different flavours.
Don't get me wrong, HL2 had some solid gameplay to it; AI was decent, weapons varied and interesting, and it was especially beautiful when it came out. However just like it's predecessor, it was hailed for having an incredibly rich story. The game was fairly short, the stories had plot holes that you could drive a small truck through, and the ending was incredibly lame; but that was overlooked by most because you had the gravity gun where you could cut zombies up with circular saw blades.
Half-Life 2: Episode One was meant to be the first in a rapid succession of episodic content for the Half Life saga which would give shorter game play but be more regularly produced, and at a reduced cost. Given it took six years for the sequel of Half-Life, slightly more regularly produced isn't setting their standards particularly high, and with Ep1, they certainly did give the shorter game play and more regular - only totaling about two-to-four hours of gameplay, and released a year after HL2.
Half-Life 2 and Doom3 were released close together, and HL2 was hailed as being much better because it actually had environments (plural) rather than just one-super-long-dark-corridor-with-a-poor-flashlight. The majority of Ep1 is made up of areas where you have little-to-no ammo, in the dark, shooting zombies. Sounds original and awesome right?
I suppose it would be wrong of me if I failed to mention just how cinematic Ep1 was. For a large slab of the game, it was like a movie, I forgot I was simply playing a game. I'm sure many industry analysts are wondering how you can achieve such immersion. Valves answer to that question is as simple as it is elegant…give the player no ammo in a First Person Shooter, but give them a "cute" female NPC that follows them around who has unlimited ammo but simply won't share. It wasn't that I was immersed, it was that I had to watch Alyx have all the fun.
I'm not far enough in to Half-Life 2: Episode Two to critisise it to the inevitable pointless rant I'll undoubtedly have in my head, but it certainly isn't promising much. It starts off with a train crash, and all of your weapons have been vapourised, yet Alex retains hers. You've also inexplicitly developed a separate battery pack so that the flashlight and running are no longer connected.
In all fairness, the Half Life games aren't bad. That is to say, they're not terrible, but they're not awesome. They fall somewhere in between, kind of what Yahtzee said about Halo 3. The Source engine is certainly good looking, and scales well, and etcetera and so forth about their technical capabilities, but at the end of the day, we've got a overly-hyped-underdelivered-game which for some reason, gets 95% or higher in "real" reviews.
1 Comment
Update: Updated binaries and source code now available from Codeplex!
Uh, not sure why, but I'd say avoid using my WGS addin until I release v0.3, because it seems to be using a massive 50% or more CPU usage - on both cores - on my laptop.
I might have to look into WMI and see if there are known performance issues with it, but for now, I'm just issuing a 'you may have problem with this program' warning.
Performance, and other things, are coming soon in v0.3 - but Uni is rearing its ugly head so the next version may not be out till the end of the week
Edit: Yeah, seems to be WMI (or at least the way I'm using it). Every game detection adds ~5% CPU usage.
My current detected amount of games gives me about 40% usage. Disable the addin drops it down to <9% CPU usage.
No Comments