D^4 := Dirty Delphi Dips'n'Dricks
System
|
Misc
|
| 'special folder' locations | ||||||||||||||||||||||||||||||||
| var p : pitemidlist; pc : pchar; begin Posssible arguments for SHGetSpecialFolderLocation are:
|
| TList of TObject |
| If you often use the TList object, you
allways are typecasting like hell. what you get is something like If TThisIsMyObject(MyObjectList[ItemCoumt]).SomeThingLikeAnInteger = 0 then ... . One problem is, that you can't read your code anymore. The other problem is, that Borland Delphi can't check, if you are using the right object right now, because you arte typecasting. Better would be a TList of TObject because you can't put items in the list, that doesn't fit in and you can't get items out of it, that aren't stored in it. To create a list, that only accepts specific objects like (in this example) real values, you have to define a new TList. Create a new unit and type something like this: unit UnitTRealList; uses classes; type TRealList = class(TList) implementation function TRealList.Add (Item: Real): Integer; Use this class and create a new TRealList. Just write Var begin The TRealList now does not accept any members but only real values (except you are typecasting), and you now can read your code. |