Hack Versus Engineering

Our legacy software has a directory chooser in it. The code makes use of the Open File dialog. However there are some modifications to the Open File dialog to make it select directories instead. This worked in Visual Studio 6. However the code aborts when compiled under Visual Studio 2005. I passed this problem to the guy responsible for the module.

The assigned developer started to research a solution to the problem. But he found himself encountering a lot of problems that might put us behind schedule. He escalated this situation to our team lead. So now I have been assigned the task of making the directory chooser work. It was recommended that I swap the code for a well designed implementation of a directory chooser. But like the other developer, I have a lot of tasks on my plate that need to get done soon.

Apparently here is what has happened. Some controls on the open file dialog have been changed. Our system's modifications assume that the controls will not change. So our code is trying to reference a control that no longer exists. Changing our code to reflect the new control stops the program from aborting. However the directory name is strangely right aligned in the edit control that our code adds to the dialog. It looks like I just need to modify this window's style. And wouldn't you know it. I could not knock out some code to reset a bit in the style DWORD. At least I was not able to do it in a couple minutes. I want to make sure the resultant code is easy to read and understand by someone who might look at it in the future. And I do not want it to be some cheap hack. I am looking to do this right. Hopefully after a good night's sleep I can get it done.