@440bx
Your post came in whilst I was typing. I take your point about bad habits but the amount of programming I do is so small and none of it 'commercial' so as long as I can understand what's going on it is of little import - but thanks for taking the trouble to bring it to my attention, you could have simply cursed me in private and I would have learned nothing
I didn't mean to curse you but, I will admit to having been just a bit annoyed (partly for having confused one variable with another.. which is my mistake). I understand your point about not programming much but, IMO, a programmer should, at least, consistently try to write the best code possible (unless it's a one time throw away kind of code.. and even then)
The one exception I make to that is when I'm giving an example. In those cases, I'll commonly use global variables (not a good thing at all) among other things I normally wouldn't but, I do it to emphasize the mechanics of the algorithm. One thing that always helps make an example (or program) clearer and easier to understand is to choose good variable names and not abbreviate them (there are exceptions, such as loop indexes - commonly named "I" and such.) I'm sure that in the example I gave you, having variables named, DriveBitmap, DriveLetter, DriveType and DrivePresent made the example easier for you to understand.
The amount of effort it takes to have good variable names is negligible but, it often makes a significant difference in how easy (or hard) a program is to understand. A few short and to the point comments put the final touch. Those two things alone can make the difference between a program that is a pleasure to read from another one that is _literally_ a chore.
My suggestion is, go out of your way to develop good programming habits, bad ones are too easy to acquire (particularly if you read a lot of C code or program in C, though I don't think you are afflicted by that problem - programming in C, that is.)
ETA:
@Bartthe function
function GetDriveType(ADrive: Char): TDriveType;
can be implemented without a case statement. The only comparison needed is to ensure that the DriveType returned by the API call is in the range of the enumerated type.