Bill Roper (billroper) wrote,
Bill Roper

Gentlemen Prefer...

For the project that I'm working on, I need to retrieve one of the preference settings that is in the registry for our application. This turned out to be -- surprise! -- more difficult than it probably should have been.

The preferences have all been loaded into memory in the COM object using a common DLL. Unfortunately, I needed the value in the C# layer which meant it was time to generate some XML to retrieve the preferences. But all of the preferences were currently keyed by their resource ID in the string table in the resource DLL. (I originally wrote the preference handling code many years ago; someone else removed my original enum indexing and replaced it with this for reasons that are not clear.) Of course, we don't have access to those resource IDs in the C# layer.

So I hand typed all of the actual strings into a C# pref class as const strings so that they'd have symbolic names to retrieve them with. There were a lot of strings. Having done this, I could write the XML that would retrieve a preference -- but after looking at it for a bit, I decided I may as well let it retrieve an arbitrary number of preferences in one call. Mind you, I still haven't written a C# interface that would generate that XML yet, but I've defined it and can parse it on the back end, so it's progress.

I also had to add methods to the C++ preference classes so that we could retrieve them by the name of the preference, but that was fairly straightforward. And while I was there, I added a method to each of the preference types to generate an appropriate XML rendering.

Since I'm still an XML tyro, it took a little time to figure out how to parse the XML using the available tools and MSXML. But I eventually sorted it out, I think. I still need to test the whole thing, but I've touched so many different classes, some of which other people will want shortly, that I'm just going to check it in now that I've gotten it to compile.

If someone else uses it before I do, they can let me know if it doesn't work right. :)
Tags: computers, microsoft, musings, tech, work

  • Time for Rebuilding

    Well, there's nothing like research. Having determined that DDR5 is going to carry a substantial price premium over DDR4 memory for at least a year…

  • Driven Wild

    The studio computer continues to misbehave in various ways. When I fired up Cubase today, I got a lot of nasty, blocky video, despite having cleaned…

  • Some Old Doggerel

    I recall having mangled a CSN tune many years ago on the way to Contraption. Like that convention, the particular co-worker whose code I was digging…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded