Unit HomeTool |
Alek's home tools. History: ~~~~~~~~ [+] -- added; [*] -- fixed; [-] -- removed; 13 December 1997: [+] function SelectFolder(aHandle: tHandle; const aRoot, aMsg: string): string; [+] function GetRegStr(const aAppName, aKeyName, aDefValue: string): string; [+] procedure SetRegStr(const aAppName, aKeyName, aKeyValue: string); 21 December 1997: [+] tFileMappingRecord; [+] function NewFileMapping(const aFileName: string; var aFMR: tFileMappingRecord): Boolean; [+] function FreeFileMapping(var aFMR: tFileMappingRecord): Boolean; [+] function SeekBuf(Buf1: Pointer; Buf1Size: Integer; Buf2: Pointer; Buf2Size: Integer): Integer; [+] function SeekStr(aBuf: Pointer; aBufSize: Integer; const aStr: string; IgnoreCase: Boolean): Integer; 25/26 December 1997: [*] bug in SeekStr; 26 December 1997: [*] GetRegStr now will not create key if it doesn't exists; 12 JAN 1998 [+] finction AddBackSlash(const aPath: string): string; 27 JAN 1998 [+] function AskYN(const aMsg: string): Boolean; [+] function AskYNC(const aMsg: string): Integer; 04 MAR 1998 [+] function Str2Int(const aStr: string; aDefValue: Integer): Integer; 15? MAR 1998 [+] function ReadTextFile(const aFileName: string): string; [+] function AddTextToFile(const aFileName, aText: string; AddCRLF: Boolean): Boolean; 05 APR 1998 [*] another bug in SeekStr -- wrong detection of buffer's end [+] function ParseString(const aString: string; aVChar: Char; aValues: tStrings); 12 APR 1998 [+] procedure SetRegInt(const aAppName, aKeyName: string; aKeyValue: Integer); [+] function GetRegInt(const aAppName, aKeyName: string; aDefValue: Integer): Integer; 20 APR 1998 [+] function Min(A, B: Integer): Integer; [+] function Max(A, B: Integer): Integer; 22 APR 1998 [*] Trim added in Str2Int for universality 30 APR 1998 [+] function Date2Str(aDate: tDateTime): string; 04 MAY 1998 [+] function RegLoadFont(aFont: tFont; const aRegAppName: string): Boolean; [+] function RegSaveFont(aFont: tFont; const aRegAppName: string): Boolean; 05 MAY 1998 [+] procedure RegSaveControl(aControl: tControl; const anAppName: string); [+] function RegLoadControl(aControl: tControl; const anAppName: string): Boolean;
Classes |
Functions |
AddBackSlash - correctly adds '\' to the given path: C:\temp\ => C:\temp\ C:\temp => C:\temp\ C:\ => C:\ C: => C: C:\temp/ => C:\temp/
AddTextToFile - adds string to text file (optionally adding CR LF after inserted line
AskYN - shows message dialog with [Yes] [No] buttons
AskYNC - show message dialog with [Yes] [No] [Cancel] buttons resturns: mrYes = Yes; mrNo = No; mrCancel = Cancel
Date2Str -
FreeFileMapping - this function frees up resources taken by NewFileMapping
GetRegInt - like GetRegStr but works with integer
GetRegStr - may change to something like HKEY_LOCAL_MACHINE used to read value from registry; aAppName -- application title (i.
Hex2Int -
Max - if A > B then result is A, else B
blah.
Min - if A < B then result is A, else B
blah.
NewFileMapping - creates new file mapping (contents of file can be accessed by pointer); aFileName -- file name to create mapping of; aFMR -- if Result is true you can use aFMR.
ParseString - will parse given string like this: // aString = Welcome to %NAME%, dear %USER% aVChar = % aValues[0] = 'NAME=Alek' aValues[1] = 'USER=Local' // result: Welcome to Alek, dear Local
ReadTextFile - just reads all text from file
RegLoadControl -
RegLoadFont -
RegSaveControl -
RegSaveFont -
SeekBuf - I have no time to test this function
WARNING: I don't test this function yet!
SeekStr - fast way to seek a substring in string (or any buffer) aBuf -- pointer to buffer to seek in; aBufSize -- size of buffer; aStr -- substring to seek; IgnoreCase -- ignore or not the case (international characters not supported!); (for binary seeking set this parameter to False); Result -- position in aBuf of firt occurance of aStr or -1 if none; (0 means start of buffer);
SelectFolder - aHandle -- handle of the owner window for the dialog box.
SetRegInt - like SetRegStr but works with integer
SetRegStr - used to write value to registry; aAppName -- application title (i.
Str2Int - safetly converts a string to Integer; if error occured, then returns aDefValue
Types |
pBytes
tBytes
tFileMappingRecord
Constants |
Variables |
Functions |
WARNING: I don't test this function yet!
WEIRD! Is this new Microsofto style?
Types |
pBytes = ^tBytes
tBytes = array[0..High(Integer)-16] of Byte;
tFileMappingRecord = recordthis record is used to store and access created file mappings
fFileHandle : tHandle;
fFileMapping : tHandle;
end;
Constants |
Variables |