Attempting to program
November 12, 2007 on 2:49 am | In Life |Warning: geeky entry coming up which is probably not even interesting to people who are going to know what the heck I’m talking about.
Boy do I hate it when this happens.
I’ve recently been in a mood where I wanted to do programming. This is remarkable, because there are plenty of games I still have to play, including Settlers 6 (which didn’t work before due to a bug in the SPTD drivers when used in combination with my on-board RAID controller (ICH7)) which I’m playing at the moment, The Witcher (good reviews) and Gears of War. Not to mention that the copy of Crysis which I pre-ordered some 3 months ago should arrive in a few days, and there’s also the new SimCity which is due this week, which many people predict will be a disappointment, but I’m not going to have an opinion on until I’ve played it.
Anyhow, I think this urge to write code comes from doing my current semester, which is called DDOA or “Develop a Distributed Object Oriented Application”. As the name suggests, it’s all about designing and writing applications that are written in object oriented languages (in this case Java) and which are distributed, meaning that they run on multiple machines at once, be it in a grid, cluster or even just multi-threaded applications.
I’ve really enjoyed this semester up to now, because it’s finally a semester on software design/architecture (which is one of the main reasons why I really wanted to study computer science: to learn how to write good programs) and it’s also a semester which finally covers some serious programming, the kind of programming which I’ve so far only done in my free time, as a hobby.
Now, I’ve been trying to write numerous applications in the last couple of days, such as a Wishlist application in which I can keep track of things I still want to buy. This program seemed like a fun exercise in C# as well as ADO.NET (more specifically, the MySQL wrapper for ADO.NET). Unfortunately, the class that was going to handle most of the database work didn’t work the way I wanted and I quickly gave up (or at least I decided to try again some other time).
I’m the owner of a G15 Gaming Keyboard which features a small 160×43 Monochrome LCD screen which can display a variety of applets, such as a Media Player applet which shows information about a variety of popular media players, a Clock applet which shows the current time (really!), a POP3 mail checker, etc. It’s a bit gimmicky, but I like it because it does certainly give me access to stuff like the current time or my media player without leaving my game. Logitech advertises the keyboard with promises that many games support the screen to show information such as ammo/health/energy, but really I only know of 5 popular games that support it. I did recently experience that TimeShift shows Health and Energy information on the screen, but since I don’t tend to look down at my keyboard when I’m playing a first person shooter, it wasn’t all that useful.
However, it is of course possible to write your own applets for this LCD screen, using a(n) (somewhat poorly documented) SDK written in C++. Yesterday I felt like messing about with it a little bit, and the end result is shown to the right. Unfortunately, displaying an image is as simple as converting it to an XPM-like file (I actually made an XPM file and converted it to the desired format manually) and telling the API to display it, while deciding what to draw at runtime (i.e. text, progressbars, etc) is considerably harder (with the lowest level API available anyway).
I decided I wanted to write two things:
- A DLL for mIRC which allows me to display and/or say my currently playing song
- A DLL for mIRC that shows the latest couple of lines from the channel in the LCD screen
To add to (what would in the end appear to be) pain, I wanted to write these DLLs in C#. Writing an application for the LCD screen I knew was possible, because EveMon, a tool which keeps track of your Eve Online character even when you’re not logged in, also displays this information on the LCD screen.
I decided to do things the quick and dirty way by just ripping the LCD screen code from EveMon and using it myself. Now all I needed to do was write a DLL that would work with mIRC. Of course I quickly figured out that writing a DLL in .NET would not make the DLL compatible with mIRC, which expects it to be written in C++, C, or some other non-.NET language. A quick search on Google told me that I could still write a plugin for mIRC by using the /com (for COM) command instead of the /dll (you guessed what for) command.
Writing the DLL itself ended up being pretty easy. After about 30 minutes of fiddling around in mIRC, I also got the COM connection to open and some simple hello world message to return from the DLL. My LCD screen however stayed awkwardly devoid of any (testing) chat lines. Furthermore, unloading the DLL kept the DLL loaded anyway, and closing mIRC resulted in it crashing.
Today I decided to move all the LCD code into a standalone application, which gave me a better shot at debugging the LCD code. Turns out it’s complaining that the LCD SDK .NET wrapper DLL (which works fine in EveMon) is a ‘bad image’ which probably has not been compiled for .NET.
The genious that I am when it comes to the internals of a compiled program, I gave up and decided to do something else, because I usually come up with some new angles to look at the problem over the span of 2 or 3 days after a problem arises.
As for the currently-playing-displaying-dll-for-mIRC: This should be a lot easier to make, although I do have to figure out how to get the relevant data from Windows Media Player. Live Messenger uses a WMP plugin, but the applet for my keyboard does not use such a plugin and THAT works, so there’s bound to be some other way using API calls or some sort of exported file.
I wish I would just decide to program something and actually just do it without running into silly issues like these. Maybe I should just stick to writing Hello World, at least that never fails for me.
No Comments yet »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^
