Delphi common functions set and brief example

xiaoxiao2021-03-06  65

ABS (X) absolute value arctan (x) Annute orthogonal COS (X) transmission back Strove function EXP (X) E X - power FRAC (X) Take a small number of int (x) Removal Ln (X) Natural pair Number SIN (X) transmission back sinusoid function value SQR (x) x * xsqrt (x) square root other PRED (X) PRED ('d') = 'c', PRED (TRUE) = 1; SUCC (X) SUCC ( 'Y') = 'z', SUCC (PRED (x)) = xord (x) See the serial number in the character set, such as ORD ('A') = 65CHR (X) CHR (65) = 'a'round (x) Self-rollerography Trunc (x) Trunc (4.8) = 4, trunc ('- 3.6') = - 3Upcase (x) Upcase ('a') = 'A'Hi (i) Hi ($ 2A30) = $ 2alo (I) LO ($ 2A30) = $ 30random (n) Generates a random integer SizeOf (Name) in [0, N) to find the number of bytes of a type or variable in memory ($ 3621) SWAP ($ 3621) = $ 2136 ================================ arithmetic routines mathematics operation ============ ==================== ABS absolute value --------------------------- ---------------------------- Unit System Function Prototype Function ABS (X); Description X is an integer OR implementation. Example Var R : Real; I: integer; begin r: = abs (-2.3); {2.3} i: = ABS (-157); {157} end; ---------------- ------------------------------------------ Arctan triangle function ----- -------------------------------------------------- --- Example Cosvar r: Extended; Begin R: = COS (PI); End; ---------------------------------------------------------------------------------------------------------------- ----------------- ----------- Sin -------------------------------------- -------------------- Example Var r: extended; s: string; begin r: = sin (pi); STR (R: 5: 3, s); Canvas.TextOut (10, 10, 'the sin of pi is' s); end; ----------------------------- ---------------------------- Unit System function prototype Function Arctan (x: extended): Extended;

Function prototype FUNCTION COS (X: Extended): Extended; Function Prototype Function SIN (x: Extended): Extended; ------------------------------------------------------------------------------------------------------------------ ------------------------------- Description X is the diameter. TAN (X) === sin (x) / COS (X) Arcsin (x) = Arctan (X / SQRT (1-SQR (x))) Arccos (X) = Arctan (SQRT (1-SQR (X)) / X) The three are not functions on the left. It is the right operation. Example Var r: Extended; Begin R: = Arctan (PI); END; example var r: extended; s: string; begin r: = sin (pi); STR (r: 5: 3, S); Canvas.Textout (10, 10, 'the sin of pi is' s); end; ---------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------- FRAC seeks a decimal part of a real number ---------- ---------------------------------------------- Unit System Function prototype FUNCTION FRAC (X: REAL): REAL; Description X is real. Example Var r: real; begin r: = Frac (123.456); {0.456} r: = Frac (-123.456); {-0.456} end; ----------------------------------------- INT asks for an integer part of a real number ---------------------------------------- Unit system function prototype Function Int (X : Real; Real; Description X is real. Example Var r: real; begin r: = int (123.456); {123.0} R: = INT (-123.0}); {-123.0} end; -------------------------------------- ---- Pi is the math PI --------------------------------------- -Unit system function prototype Function PI: Extended; Description it is a function, but we will use it as a preset variable! Pi = 3.1415926535897932385 --------------- ------------------------------------------- ---------------------- Example Var S, Temp: String; Begin Str (SQR (5.0): 3: 1, TEMP); S: = '5 Squared is' Temp # 13 # 10; Str (SQRT (2.0): 5: 4, TEMP); S: = S 'The Square Root of 2 IS' TEMP; Messagedlg (S, Mtinformation, [Mbok] , 0);

----------------------------------------- SQRT X square root ----- ------------------------------------- Unit system function prototype Function SQR (x: extended): Extended Function prototype Function SQRT (x: extended): Extended; example var s, temp: string; begin Str (SQR (5.0): 3: 1, TEMP); s: = '5 squared is' TEMP # 13 # 10; STR (SQRT (2.0): 5: 4, TEMP); s: = S 'The Square Root of 2 IS' TEMP; Messagedlg (s, mtinformation, [mbok], 0); end; --------------------------------------- LN Natural logar ------- ---------------------------------- Example Var E: Real; s: string; begin E: = EXP (1.0); STR (ln (e): 3: 2, s); s: = 'e =' floattostr (e) '; ln (e) =' s; canvas.textout (10, 10, S); END; --------------------------------------- EXP Index --- -------------------------------------- Unit System Function prototype Function LN (x: Real) : Real; function prototype Function Exp (x: real): real; example var E: real; s: string; begin E: = Exp (1.0); STR (LN (E): 3: 2, s); s: = 'Ln (e) =' S; canvas.textout (10, 10, s); end; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- Date Retrieve the current date Unit Systemils function prototype Function date: tdatetime; example procedure tform1.button1click (sender: TOBJECT); begin label1.caption: = 'Today is' DateTostr (Date); end; -------------- -------------------------- DateTimetostr Date Time Convert to an internal stereotype (1996/12/20 09:12:20 PM) - ---------------------------------------- Unit sysutils function prototype Function DateTimetostr (datetime: tdatetime : String; Example Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); begin label1.caption: = DATETITOSTR (now);

-------------------------------------------------- ------ DateTimetString Date Time Convert to a self-defined string --------------------------------- ------------------- Unit sysutils function prototype Procedure DateTimetostring (var Result: string; const format: string; datetime: tdatetime); Sample Procedure TFORM1.FORMCREATE (Sender: TOBJECT); var s: string; begin datetimetostring (s, 'dddd, mmmm d, yyyy "at" hh: mm am / pm', now); label1.caption: = S; end; results Friday, December 20 , 1996 AT 09:20 PM --------------------------------------------------------------------------------------------------------------------------------- ---------------------------------- **** Format format exams below .formatdatetime. ------ -------------------------------------------------- The DateTostr Date is converted into an internal stereotype. (1996/12/20) -------------------------------- ------------------------ Unit sysutils function prototype Function DateTostr (date: tdatetime): String; Sample Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); Begin Label1.caption: = 'Today Is' DateTostr (Date); end; # Date, DateTostr Example ------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- -Unit sysutils function prototype Function Dayofweek (Date: TdateTime): Integer; Note The return value is an integer, 1 ~ 7. Sunday is 1. Example procedure tform1.button1click (sender: TOBJECT); var adtere: tdatetime; days: array [1..7] of string; begin days [1]: = 'sunday'; days [2]: = 'monday'; days [3]: = 'Tuesday'; days [4]: ​​= 'Wednesday'; Days [5]: = 'Thursday'; Days [6]: = 'frIDay'; days [7]: = 'Saturday'; adate: = strtodate (edit1.text); showMessage (Edit1.Text 'Is A' Days [dayofweek (adate)];

# Stradate, Dayofweek Example --------------------------------------------- ---------- Decodedate changes the date variable to the TDATETIME type, and turn to Word type. -------------------------------------------------------------------------- -------------------------------- Example procedure tform1.button1click (sender: TOBJECT); VAR Present: tdatetime; Year, Month, Day, Hour, min, sec, msec: word; begin present: = now; decodate (present, year, month, day); label1.caption: = 'Today' $ INTOSTR (DAY) 'of Month ' INTSTOSTR (MONTH) ' of year ' INTOSTR (YEAR); Decodetime (Present, Hour, min, sec, msec); label2.caption: =' Time is minute ' INTOSTR (min) of Hour ' INTOSTR (Hour); end; # decodate, decodetime example ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------ Decodetime to turn the TDATETIME type time variable, turn to Word type. --------------- ---------------------------------------- Unit sysutils function prototype Procedure Decodedate (Date: TDATETIME; VAR Year, Month, Day: Word; Function Prototype Procedure Decodetime (Time: TdateTime; Var Hour, Min, Sec, Msec: Word); Example Procedure TFORM1.BUTTON1CLICK (Sen DER: TOBJECT); VAR Present: Tdatetime; Year, Month, Day, Hour, min, sec, msec: word; begin present: = now; decodate (present, year, month, day); label1.caption: = 'TODAY Is Day ' INTOSTR (DAY) ' of MONTH ' INTOSTR (MONTH) ' of year ' INTOSTOSTR (YEAR); Decodetime (Present, Hour, min, sec, msec); label2.caption: =' Time Is Minute ' INTOSTR (MIN) ' of Hour ' INTOSTR (HOUR); END; --------------------------------------------------------------------------------------------------------------------------------- -------------------------- Encodedate changes the date of the Word type,

Go to TDATETIME type. -------------------------------------------- ------------ Example Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); var mydate: tdatetime; begin mydate: = encodedate Edit3.text); label1.caption: = DATETOSTR (MyDate); end; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- Encodetime to turn the Word type time variable, turn to TDATETIME type. -------------- ------------------------------------------ Unit sysutils function prototype Function EncodeDate (Year, Month, Day: Word): TDateTime; function prototype function EncodeTime (Hour, Min, Sec, MSec: Word): TDateTime; example procedure TForm1.Button1Click (Sender: TObject); var MyDate: TDateTime; MyTime: TDateTime; Begin mydate: = encodedate (83, 12, 31); label1.caption: = DATETOSTR (MyDate); MyTime: = Encodetime (0, 45, 45, 7); label2.caption: = Timetostr (MyTime); END; example Procedure TForm1.Button1Click (Sender: Tobject); var mytime: tdatetime; begin mytime: = encodetime (0, 45, 45, 7); label1.caption: = Timetostr (MyTime); End; ---------------------------------------------------------------- ------- formatDateTime converts the date time in format's format to a string. --------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------- Unit sysutils function prototype Function FormatDatetime (const format: string; datetime: tdatetime): string;

**** Similar to DateTimetString.Format format C-fixed shortdateformat format. (1996/12/20 09:20:15 pm) .D dates, not completed in front. (1-31) DD date, before complement 0. (01-31) DDD Week. (Sunday) .dddd Chinese version 2.01, the same .ddddd Date. (1996/12/20) DDDDDD date. (December 20, 1996) M month, not completed 0. (1 -12) MM, previously added 0. (01-12) MMM Chinese display. (December) MMMM Chinese version 2.01, the same .yy year. (0000-9999) H hours. (0-23) HH hours. (00-23) n minutes. (0-59) NN minute. (00-59) s second. (0-59) SS seconds. (00-59) T Time. (09:20 PM) TT time. (09:20:15 pm) AM / PM separately displays AM OR PM. (If uppercase, larger is displayed) A / P separately displays a or P. Example the following example Assigns' the Meeting is on Wednesday, February 15, 1995 At 10:30 am 'to the string variable s: = formatdatetime (' "" the Meeting is on "DDDD, MMMM D, YYYY," AT "hh: mm am / pm ' STRTODATETIME ('2/15/95 10:30 am')); // ??? ----------------------------- --------------------------- NOW back to the current date. --------------- ---------------------------------------- Unit sysutils function prototype Function now: TDATETIME Sample procedure tform1.button1click (sender: TOBJECT); begin label1.caption: = DateTimetostr (now); end; # now, datetimetostr esample ---- -------------------------------------------------- --STRTODATE turns the string to the TDATETIME type. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------- Unit sysutils function prototype Function Strtodate (const s: string): tdatetime; sample procedure tform1.button1click (sender: TOBJECT); var Adate: tdatetime Begin adate: = strandate (edit1.text); label1.caption: = DATETOSTR (Adate); end; example procedure tform1.button1click (sender: TOBJECT); VAR Adate: tdatetime; days: array [1..7] of String; Begin Days [1]: = 'Sunday'; Days [2]: = 'Monday'; days [3]: = 'Tuesday'; days [4]: ​​= 'Wednesday'; days [5]: = ' Thursday '; DAYS [6]: =' frIDay ';

Days [7]: = 'SATURDAY'; adate: = strTodate (edit1.text); showMessage (edit1.text 'is a' days [dayofweek (adate)]; end; # strtodate, dayofweek eXample ---- -------------------------------------------------- --STRTODATETIME Time to turn the string to the TDATETIME type. ----------------------------------- --------------------- Unit sysutils function prototype Function Strtodatetime (const s: string): tdatetime; example procedure tForm1.button1click (sender: TOBJECT); VAR AdatendTime: TDATETIME: = strandTime (edit1.text); table1.fieldByname ('timestamp'). Asdatetime: = adatendTime; end; ------------------- ---------------------------------- Strtotime Time to turn the string into the TDATETIME type. --- -------------------------------------------------- --- Unit SysUtils function prototype function strToTime (const S: string): TDateTime; example procedure TForm1.Button1Click (Sender: TObject); var aTime: TDateTime; begin aTime: = strToTime (Edit1.Text); if aTime <0.50 then ShowMessage ('Good Morning') Else ShowMessage ('Good Afternoon'); End; ------------------------ ------------------------------- Time passed the time. ----------- -------------------------------------------- Unit sysutils function prototype Function Time: TDateTime; example procedure TForm1.Timer1Timer (Sender: TObject); var DateTime: TDateTime; str: string; begin DateTime: = Time; // store the current date and time str: = TimeToStr (DateTime); // convert the Time Into A String Caption: = Str; // Display The Time on The form's capen {Note This Could Have Been Done with the following line of code: Caption: = Timetostr (TIME);

# Time, Timetostr Example --------------------------------------------------------------- ----------- Timetostr Time Convert into an internal stereotype. (09:20:15 pm) ---------------------- -------------------------------- Unit sysutils function prototype Function Timetostr (Time: tdatetime): String; getMem Procedure Configure the memory space of the memory program NEW to configure the memory space of the native P. ---------------------------- ----------------------------- Dispose releases the memory configured by New .---------- -------------------------------------------- Unit system function prototype procedure New (var P: Pointer); function prototype procedure Dispose (var P: Pointer); sample type PListEntry = ^ TListEntry; TListEntry = record Next: PListEntry; Text: string; Count: Integer; end; var List, P: PListEntry Begin ... new (p); p ^ .next: = list; p ^ .text: = 'Hello World'; P ^ .count: = 1; List: = P; ... Dispose (P); ... end; example type str18 = string [18]; var p: ^ str18; begin new (p); p ^: = 'now you see it ...'; Dispose (p); {now you don't. ..} End; --------------------------------------------- - --------- GetMEM Configuration Remarks The memory space, the size can be set yourself. ------------------------ ------------------------------- Example Var f: File; Size: Integer; Buffer: Pchar; Begin Assignfile (f , 'Test.txt'); Reset (f, 1); try size: = filesize (f); getMem (buffer, size); Try BlockRead (f, buffer ^, size); processfile (buffer); Finally FreeMem (buffer); end; f); end; end; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- FreeMem Releases the memory configured by GetMem. ------------------ -------------------------------------- Unit system function prototype procedure getmem (var P: Pointer; SIZE: Integer; function prototype Procedure FreeMem (var P: Pointer [; size: integer]); example var f: file;

Size: Integer; buffer; begin assignfile (f, 'test.txt'); reset (f, 1); try size: = filesize (f); getMem (buffer, size); try blockread (f, buffer ^ , Size); ProcessFile (buffer, size); Finally FreeMem (buffer); end; fin or closefile (f); end; end; ====================== =============== file-management routines file management Circular =========================== ========= ----------------------------------------- --------------- ChangefileExt Change Archive --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------- Unit sysutils function prototype Function ChangefileExt (const filename, extension: string): string; example procedure tForm1.button1click (Sender: TOBJECT); VAR S: STRING; P1: String; P2: String; Begin P1: = 'abc.txt'; p2: = '. Ini'; s: = ChangefileExt (P1, P2); Label1.caption : = S; END; Results s == 'abc.ini' P1: = 'ABC' P2: = '. INI' S == 'Abc.ini' p1: = 'c: /windows/abc.txt' P2 : = '. INI' s == 'c: /windows/abc.ini' p1: = 'abc.txt' p2: = 'INI' s == 'Abcini '** Note: The first element of P2 must have a little' .ini 'example procedure tform1.converticon2bitmapClick (Sender: Tobject); var s: string; icon: ticon; begin openDialog1.default: =' .ico '; OpenDialog1 .Filter: = 'icons (* .ico) | * .ico'; OpenDialog1.Options: =

[OfOverwritePrompt, ofFileMustExist, ofHideReadOnly]; if OpenDialog1.Execute then begin Icon: = TIcon.Create; try Icon.Loadfromfile (OpenDialog1.FileName); s: = ChangeFileExt (OpenDialog1.FileName, '. BMP'); Image1.Width: = Icon.width; image1.height: = icon.Height; image1.canvas.draw (0, 0, icon); Image1.Picture.Savetofile (s); showMessage (OpenDialog1.FileName Saved to ' S); Finally icon.free; end; end; end; # savetofile, create, height, width, canvas, changefileext example ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ SYSUTILS Function Prototype Function ExpandFileName (const filename: String): String; Description Set the current directory to c: / windows file name is abc.txt result is C: /Windows/abc.txt **** This function is not to ask for ABC The path of .txt. Sample procedure tform1.button1click (sender: Tobject); var s: string; begin s: = expandFileName ('abc.txt'); label1.caption: = s; end; example Procedure TFO RM1.Button1Click (sender: Tobject) Begin ListBox1.Items.Add (EDIT1.TEXT)); END; ------------------------- ----------------------------------------- DirectoryExists directory exists ----- -------------------------------------------------- ----------- UnitFileCtrluses filectrl; procedure tform1.button1click (sender: Tobject); Begin if not Directoryexists ('c: / temp') Then if not createdir ('c: / temp') THEN RAISE Exception.create ('Cannot Create C: / Temp'); End; ---------------------------------- ---------------------- Forcedirector Directory -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------ Unit FileCtrl function prototype Function Forcedirector (Dir: String): Boolean;

Procedure TForm1.Button1Click (Sender: TOBJECT); VAR DIR: STRING; Begin Dir: = 'C: / Apps / Sales / Local'; if Directoryexists (DIR) THEN Label1.caption: = Dir 'Was Created'ENED; -------------------------------------------------- ----- ExpanduncFileName is the same as above (just get the path on the Internet) --------------------------------- -------------------- Unit sysutils function prototype Function ExpanduncFileName (const filename: string): String; ExtractFileDir Analysis string Path Unit sysutils Function Prototype Function ExtractFileDir Const filename: string: String; Description Set the s string is c: /windows/abc.txt result is the result of the C: / Windows **** function is to analyze its path to analyze its path Sample Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); var s: string; p1: string; begin p1: = 'c: /windows/abc.txt'; s: = extractfiledir (p1); label1.caption: = S; End; s == 'c: / windows' p1: = 'Abc.txt' s == 'p1: =' c: abc.txt 's ==' c: 'p1: =' c: /abc.txt 'S ==' c: / '--------------------------------------- ------------------------------------------------------------------------------------------------------------------------------ ------------------------------ Unit Sy SUTILS function prototype Function ExtractFileDrive (const filename: String): String; **** functionally, only back the disk machine name. Seminyes Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); var s: string; p1: string; begin P1: = 'c: /windows/abc.txt'; s: = extractfileDrive (p1); label1.caption: = s; end; s: = 'c:' p1: = 'abc.txt' s == ' -------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------ Unit sysutils function prototype Function ExtractFileExt (const filename: string): String;

Sample Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); var s: string; p1: string; begin p1: = 'c: /Windows/abc.txt'; s: = extractfileext (p1); label1.caption: = S; End; s == '. txt' p1: = 'c: / windows / abc' s == 'example myfilesextension: = extractfileext (myFileName); ----------------- -------------------------------------- ExtractFileName Analysis String Archive Name (only Playing the name of the file) -------------------------------------------- --------- Unit sysutils function prototype Function ExtractFileName (const filename: string): string; sample procedure tform1.button1click (sender: TOBJECT); var s: string; p1: string; begin p1: = ' C: /Windows/abc.txt '; s: = extractFileName (p1); label1.caption: = s; end; s ==' abc.txt 'example procedure tform1.button1click (sender: Tobject); var backupname: String ; FileHandle: Integer; StringLen: Integer; X: Integer; Y: Integer; begin if SaveDialog1.Execute then begin if FileExists (SaveDialog1.FileName) then begin BackupName: = ExtractFileName (SaveDialog1.FileName); Backu pName: = ChangeFileExt (BackupName, '.BAK'); if not RenameFile (SaveDialog1.FileName, BackupName) then raise Exception.Create ( 'Unable to create backup file.'); end; FileHandle: = FileCreate (SaveDialog1.FileName) ; {. Write out the number of rows and columns in the grid} FileWrite (FileHandle, StringGrid1.ColCount, SizeOf (StringGrid1.ColCount)); FileWrite (FileHandle, StringGrid1.RowCount, SizeOf (StringGrid1.RowCount)); for X: = 0 to stringgrid1.colcount? 1 do begrain for y: =

? 0 to StringGrid1.RowCount 1 do begin {Write out the length of each string, followed by the string itself.} StringLen: = Length (StringGrid1.Cells [X, Y]); FileWrite (FileHandle, StringLen, SizeOf (StringLen) FileWrite (FileHandle, StringGrid1.cells [x, y], length (stringgrid1.cells [x, y]); end; end; fileclose (filehandle); end; end; ## fileexists, renamefile, filecreate, filewrite, FileClose, ExtractFileName EXAMPLE -------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------- Unit sysutils function prototype Function ExtractFilePath (const filename: string): string; Description Set the s string is C: / Windows / ABC .txt results as c: / windows example procedure tform1.button1click (sender: Tobject); var s: string; p1: string; begin p1: = 'c: /Windows/abc.txt'; s: = extractfilepath (p1 ); Label1.caption: = s; end; example begin with session do beg, configmode: = cmsession; Try AddStandardalias ('Tempdb', ExtractFilePath (paramstr (0)), 'paradox'); Finally Configmode: = Cmall; End; End; ## configmode, addstandardalias, extractfilepath example ------------------- ------------------------------------- FileSearch Looking for the correct path in the disk machine - -------------------------------------------------- ---- Unit Sysutils Function Prototype Function FileSearch (const name, dirlist: string): string; example var s: string; begin s: = filesearch ('abc.txt', 'c: / window /'); label1. CAPTION: = S; END; Description Recovered C: /Window/abc.txt Can't pass the empty string. Example procedure tform1.button1click (sender: TOBJECT); var buffer: array [0..255] of Char; filetofind: String; Begin getWindowsDirectory (buffer, sizeof (buffer); filetofind: =

FileSearch (Edit1.Text, getCurrentDir ';' buffer); if filetofind = 'Then ShowMessage (' COULDN '.') Else ShowMessage ('Found' FileTofind ') ; End; ## filesearch, ShowMessage Example ----------------------------------------- --------------- Fileage Retrieves the date and time (DOS style). --------------------- --------------------------------- Unit sysutils function prototype Function Fileage (const filename: string): Integer; The description is the date of modification of the archive content of the archive. Example procedure tform1.button1click (sender: TOBJECT); var s: string; filedate1: integer; datetime1: tdatetime; begin filedate1: = fileage ('c: / delphi_d / delphi_help1 .txt '); DateTime1: = fileDatetodatetime (filedate1); s: = DateTimetostr (datetime1); label1.caption: = s; end; -------------------- ---------------------------------- FileDateTodateTime converts the DOS type date time to TDATETIME. -------------------------------------------------- ----- Unit sysutils Function Prototype Function FileDatetodatetime (Filedate: Integer): TDATETIME; ------------------- -------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ SYSUTILS Function Prototype Function DateTimetOfileDate (DateTime: Tdatetime): Integer; FilegetDate Replies Date and Time (DOS Site) .unit System: Integer (Handle: Integer): Integer; Description is the archive of the archive Examples of modified date procedure TForm1.Button1Click (Sender: TObject); var FileHandle:. Integer; S: String; FileDate1: Integer; DateTime1: TDateTime; begin FileHandle: = FileOpen ( 'c: /delphi_d/delphi_help2.txt', fmOpenReadWrite IF FileHandle>

0 then Begin FileDate1: = FileGetDate (FileHandle); DateTime1: = FileDateToDateTime (FileDate1); S: = DateTimeToStr (DateTime1); FileClose (FileHandle); End else S: ​​= 'Open File Error'; Label1.Caption: = S; End; ---------------------------------------------------------------- ----------------------------- FileSetDate Sets the date and time (DOS style). ------- -------------------------------------------------- ------------------ - Unit sysutils function prototype Function FileSetdate (Handle: Integer; age: integer; Integer; Note The return value is 0 means success .--- -------------------------------------------------- ------------------------ Deletefile Delete Archive --------------------- -------------------------------------------------- ---- Unit sysutils function prototype Function deletefile (const filename: String): boolean; example one deletefile ('delete.me'); example IF fileexists (filename) Then IF Messagedlg ('do you real want to delete' ExtractFileName (filename) '?'), []) = IDYES THEN Deletefile (filename); ## fileexists, deletefile example ---------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ------------------- Unit sysutils function prototype Function Renamefile (const6ame, newname: String): boolean; example procedure tForm1.button1click (sender: Tobject); var backupname: string; FileHandle: Integer; StringLen: Integer; X: Integer; Y: Integer; begin if SaveDialog1.Execute then begin if FileExists (SaveDialog1.FileName) then begin BackupName: = ExtractFileName (SaveDialog1.FileName); BackupName: = ChangeFileExt (BackupName '

.BAK '); if not RenameFile (SaveDialog1.FileName, BackupName) then raise Exception.Create (' Unable to create backup file '); end; FileHandle:. = FileCreate (SaveDialog1.FileName); {Write out the number of rows and columns in the grid} FileWrite (FileHandle, StringGrid1.ColCount, SizeOf (StringGrid1.ColCount)); FileWrite (FileHandle, StringGrid1.RowCount, SizeOf (StringGrid1.RowCount)); for X:. = 0 to StringGrid1.ColCount 1? do begin for Y: = 0 to StringGrid1.RowCount 1 do begin {Write out the length of each string, followed by the string itself.} StringLen:? = length (StringGrid1.Cells [X, Y]); FileWrite (FileHandle, Stringlen, SIZEOF (STRINGLEN)); FileWrite (FileHandle, StringGrid1.cells [x, y], length (stringgrid1.cells [x, y]); end; end; fileclose (filehandle); end; -------------------------------------------------- ----------------------- DiskFree disk ------------------- --------- -------------------------------------------------- -Unit sysutils function prototype Function Diskfree (drive: Byte): Integer; sample var s: string; begin s: = INTOSTR (Diskfree (0) Div 1024) 'KBytes Free.'; Label1.caption: = S; end; Description DRIVE 0 = Current drive, 1 = A disk machine, 2 = B disk machine ... The transmission value is -1, indicating that the disk machine detection error is indicated. Example var s: string; amtfree: int64 Total: int64; Begin Amtfree: = DiskFree (0); Total: = disksize (0); s: = INTSTOSTR (AMTFREE DIV TOTAL) 'Percent of the space on drive 0 is free:' (Amtfree Div 1024) 'Kbytes free.'; Canvas.textout (10, 10, s); end;

## Diskfree, Disksize Example ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------- DISKSIZE DVD machine Space size (bytes) -------- -------------------------------------------------- ------------------- Unit sysutils function prototype Function Disks (Drive: Byte): Integer; example var s: string; begin s: = INTOSTR (Disksize) Div 1024) 'kbytes free.'; Label1.caption: = S; end; Description Drive 0 = Current disk machine, 1 = A disk machine, 2 = B disk machine .... The transmission value is 1, indicating that the disk machine detection is wrong. ## diskfree, Disksize Example -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------ "FileExists judges whether the file exists. -------------------------------------------------- -------------------------- Unit sysutils function prototype FUNCTION FILEEXISTS (Const filename: string): boolean; similar FileExists, Renamefile, FileCreate, FileWrite, FileClose, ExtractFileName example example procedure TForm1.Button1Click (Sender: TObject); var BackupName: string; FileHandle: Integer; StringLen: Integer; X: Integer; Y: Integer; begin if SaveDialog1.Execute then begin if FileExists (SaveDialog1.FileName) then begin BackupName: = ExtractFileName (SaveDialog1.FileName); BackupName: = ChangeFileExt (BackupName, '.BAK'); if not RenameFile (SaveDialog1.FileName, BackupName) then raise Exception.Create ( 'Unable . to create backup file '); end; FileHandle: = FileCreate (SaveDialog1.FileName); {Write out the number of rows and columns in the grid.} FileWrite (FileHandle, StringGrid1.ColCount, SizeOf (StringGrid1.ColCount)); FileWrite (FileHandle, StringGrid1.Rowcount); for x: = 0 to stringgrid1.colcount? 1 do beg Y: =

? 0 to StringGrid1.RowCount 1 do begin {Write out the length of each string, followed by the string itself.} StringLen: = Length (StringGrid1.Cells [X, Y]); FileWrite (FileHandle, StringLen, SizeOf (StringLen) ); FileWrite (FileHandle, StringGrid1.cells [x, y], length (stringgrid1.cells [x, y]); end; end; fileclose (filehandle); end; end; ## fileexists, deletefile examplefile ## fileexists, Renamefile, FileCreate, FileWrite, FileClose, ExtractFileName Example ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------ Fileopen opens. --------- -------------------------------------------------- ----------------- Unit Sysutils Function Prototype Function FileOpen (const filename: integer; **** Open file failed to return to -1. Description the following relevant files read are of low order, such as the Dos Int 21h related file portions fmOpenRead = $ 0000;. fmOpenWrite = $ 0001; fmOpenReadWrite = $ 0002; fmShareCompat = $ 0000; fmShareExclusive = $ 0010; fmShareDenyWrite = $ 0020; fmShareDenyRead = $ 0030; fmShareDenyNone = $ 0040;..... fmOpenRead Open for read access only FmOpenWrite Open for write access only FmOpenReadWrite Open for read and write access fmShareCompat Compatible with the way FCBs are opened fmShareExclusive Read and write access is denied fmShareDenyWrite Write access is denied fmShareDenyRead. Read access is denied fmShareDenyNone Allows full access for others example procedure OpenForShare (const FileName: String); var FileHandle:.. Integer; begin FileHandle: = FileOpen (FileName, fmOpenWrite or fmShareDenyNone); if FileHandle> 0 then {valid file handle} Else {Open Error: FileHandle = Negative DOS Error Code} end;

Example procedure TForm1.Button1Click (Sender: TObject); var iFileHandle: Integer; iFileLength: Integer; iBytesRead: Integer; Buffer: PChar; i: Integerbegin if OpenDialog1.Execute then begin try iFileHandle: = FileOpen (OpenDialog1.FileName, fmOpenRead); iFileLength: = FileSeek (iFileHandle, 0,2); FileSeek (iFileHandle, 0,0); Buffer: = PChar (AllocMem (iFileLength 1)); iBytesRead = FileRead (iFileHandle, Buffer, iFileLength); FileClose (iFileHandle); For i: = 0 to ibytesread-1 do begin stringgrid1.rowcount: = stringgrid1.rowcount 1; stringgrid1.cells [1, i 1]: = buffer [i]; stringgrid1.cells [2, i 1]: = INTOSTR (Integer (buffer [i])); end; finally freemem (buffer); end; end; end; ## fileopen, fileseek, fileread example ---------------- -------------------------------------------------- ----------- FileCreate ---------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- Unit sysutils function prototype Function FileCreate const FileName: string): Integer; Example procedure TForm1.Button1Click (Sender: TObject); var BackupName: string; FileHandle: Integer; StringLen: Integer; X: Integer; Y: Integer; begin if SaveDialog1.Execute then begin if FileExists ( SaveDialog1.FileName) then begin BackupName: = ExtractFileName (SaveDialog1.FileName); BackupName: = ChangeFileExt (BackupName, '.BAK'); if not RenameFile (SaveDialog1.FileName, BackupName) then raise Exception.Create ( 'Unable to create backup File. '); end; filehandle: = filecreate (Savedialog1.FileName);

{. Write out the number of rows and columns in the grid} FileWrite (FileHandle, StringGrid1.ColCount, SizeOf (StringGrid1.ColCount)); FileWrite (FileHandle, StringGrid1.RowCount, SizeOf (StringGrid1.RowCount)); for X: = 0 to StringGrid1.ColCount 1 do begin for Y:? = 0 to StringGrid1.RowCount 1 do begin StringLen? {Write out the length of each string, followed by the string itself.}: = length (StringGrid1.Cells [X, Y ]); FileWrite (FileHandle, Stringlen); FileWrite (FileHandle, StringGrid1.cells [x, y], length (stringgrid1.cells [x, y]); end; end; fileclose (fileHandle); ; End; ## FileExists, Renamefile, FileCreate, FileWrite, FileClose, ExtractFileName Example ------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------ FileClose Off --- -------------------------------------------------- ------------------------ Unit sysutils function prototype Procedure FileClose (Handle: Integer); Example Procedure TFORM 1.Button1Click (Sender: TObject); var BackupName: string; FileHandle: Integer; StringLen: Integer; X: Integer; Y: Integer; begin if SaveDialog1.Execute then begin if FileExists (SaveDialog1.FileName) then begin BackupName: = ExtractFileName (SaveDialog1.FileName); BackupName: = ChangeFileExt (BackupName, '.BAK'); if not RenameFile (SaveDialog1.FileName, BackupName) then raise Exception.Create ( 'Unable to create backup file.'); end; FileHandle: = FileCreate (Savedialog1.FileName); {Write out the number of rows and columns in the grid.} FileWrite (FileHandle (FileHandle, StringGrid1.colcount);

FileWrite (FileHandle, StringGrid1.RowCount, SizeOf (StringGrid1.RowCount)); for X:?? = 0 to StringGrid1.ColCount 1 do begin for Y: = 0 to StringGrid1.RowCount 1 do begin {Write out the length of each string , followed by the string itself} StringLen:. = Length (StringGrid1.Cells [X, Y]); FileWrite (FileHandle, StringLen, SizeOf (StringLen)); FileWrite (FileHandle, StringGrid1.Cells [X, Y], Length ( Stringgrid1.cells [x, y]); end; end; fileclose (filehandle); end; end; ## fileexists, renamefile, filecreate, filewrite, fileclose, extractFileName Example ============= =============================== **** It is the number of Handle. ======= ============================================== fiedread read the file --------- -------------------------------------------------- ------------------ Unit sysutils function prototype Function FileRead (Handle: Integer; var buffer; count: integer): Integer; sample procedure tform1.button1click (sender: TOBJECT); Var ifileHandle: Integer; IFileLength: INTEGER ; IBytesRead: Integer; Buffer: PChar; i: Integerbegin if OpenDialog1.Execute then begin try iFileHandle: = FileOpen (OpenDialog1.FileName, fmOpenRead); iFileLength: = FileSeek (iFileHandle, 0,2); FileSeek (iFileHandle, 0,0 ); Buffer: = pchar (allilelength 1); ibytesread = fileread (ifilehandle, buffer, ifilength);

FileClose (ifilehandle); for i: = 0 to ibytesread-1 do begin stringgrid1.rowcount: = stringgrid1.rowcount 1; stringgrid1.cells [1, i 1]: = buffer [i]; stringgrid1.cells [2, i 1]: = INTTOSTR (Integer (buffer [i])); end; finally freemem (buffer); end; end; end; ## fileopen, fileseek, fileread example ----------- -------------------------------------------------- --------------- FileWrite Write into the Archive ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------- Unit sysutils function prototype function FileWrite (Handle: Integer; const Buffer; Count: Integer): Integer; example procedure TForm1.Button1Click (Sender: TObject); var BackupName: string; FileHandle: Integer; StringLen: Integer; X: Integer; Y: Integer; begin if SaveDialog1.Execute then begin if FileExists (SaveDialog1.FileName) then begin BackupName: = ExtractFileName (SaveDialog1.FileName); BackupName: = ChangeFileExt (BackupName, '.BAK'); if not RenameFile (SaveDialog1.FileName, Backup Name) then raise Exception.Create ( 'Unable to create backup file.'); End; FileHandle: = FileCreate (SaveDialog1.FileName); {Write out the number of rows and columns in the grid.} FileWrite (FileHandle, StringGrid1. ColCount, SizeOf (StringGrid1.ColCount)); FileWrite (FileHandle, StringGrid1.RowCount, SizeOf (StringGrid1.RowCount)); for X: = 0 to StringGrid1.ColCount do begin for Y: = 0 to StringGrid1.RowCount do begin {Write Out the length of each string, followed by the string itself.} Stringlen: = Length (StringGrid1.cells [x, y]); FileWrite (FileHandle, Stringlen, Sizeof (Stringlen);

Filewrite (FileHandle, StringGrid1.cells [x, y], length (stringgrid1.cells [x, y]); // ?????????? / end; end; fileclose (fileHandle); END; ## FileExists, Renamefile, FileCreate, FileWrite, FileClose, ExtractFileName Example ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- Fileseek mobile archive indicator location ---- -------------------------------------------------- ----------------------- Unit sysutils function prototype Function Fileseek (Handle, Offset, Origin: Integer): Integer; Description Origin = 0 Read / write indicator The beginning of the file is counted. Origin = 1 read / write indicator is calculated from the current position. Origin = 2 read / write indicators move to the end of the file. **** Features is the same as the DOS INT 21h interrupted 42h. Failure -1 example procedure TForm1.Button1Click (Sender: TObject); var FileHandle:. Integer; FileName: String; Buffer: PChar; S: String; ReadBytes: Integer; begin FileName: = 'c: /delphi_test/abc.ttt'; S: = '1234567890'; if FileExists (fileEname) THEN FILEHANDLE: = FileOpen (FMopenreadwrite) Else FileHandle: = FileCreate (filename); if FileHandle <0 Then Begin Messagedlg (Failed ', Mtinformation, [MboK], 0); EXIT; End; GetMem (Buffer, 100); Try Strpcopy (Buffer, S); FileWrite (FileHandle, Buffer ^, 10); Fileseek FileHandle, 4, 0); ReadBytes: = FileRead (FileHandle, Buffer ^, 100); Buffer [ReadBytes]: = # 0; label1.caption: = INTOSTOSTR (READBYTES) '' STRPAS (Buffer); Finally FreeMem Buffer; end; fileclose (FileHandle); END; Results After Archive Abc.tt Ten Bytes. From the fifth bit, read six bits. 567890 (displacement is starting from 0 From the procedure tform1.button1click (sender: Tobject); VAR iFileHandle: Integer; IbytesRead: integer; ibytesread: integer; buffer: pchar;

i: Integerbegin if OpenDialog1.Execute then begin try iFileHandle: = FileOpen (OpenDialog1.FileName, fmOpenRead); iFileLength: = FileSeek (iFileHandle, 0,2); FileSeek (iFileHandle, 0,0); Buffer: = PChar (AllocMem ( iFileLength 1)); iBytesRead = FileRead (iFileHandle, Buffer, iFileLength); FileClose (iFileHandle); for i: = 0 to iBytesRead-1 do begin StringGrid1.RowCount: = StringGrid1.RowCount 1; StringGrid1.Cells [1, i 1]: = buffer [i]; stringgrid1.cells [2, i 1]: = INTTOSTR (Integer (buffer (buffer [i])); end; finally freemem (buffer); end; end; end; ## FileOpen, Fileseek, FileRead Example ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------- Filegetttr file properties -------------- -------------------------------------------------- ------------- Unit sysutils function prototype Function Filegetttr (const filename: string): Integer; Description FareadOnly = $ 00000001; Fahidden = $ 00000002; FasysFile = $ 00000004; FAVOLUMEID = $ 0000000 8; faDirectory = $ 00000010; faArchive = $ 00000020; faAnyFile = $ 0000003F; Example procedure TForm1.Button1Click (Sender: TObject); var S: String; begin S: = IntToStr (FileGetAttr ( 'c: /delphi_d/delphi_help1.txt') ); Label1.caption: = s; end; -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------- FileSetattr Settings file properties ------- -------------------------------------------------- ------------------- Unit sysutils function prototype Function FileSetattr (Const FileName: String; Attr: Integer): Integer;

Description Setting success back 0 ----------------------------------------- --------------------------------- Findnext ----------- -------------------------------------------------- ---------------- Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); Var Sr: TsearchRec; FileAtTRS: Integer; Begin StringGrid1.Rowcount: = 1; if CheckBox1.checked Then FileAtTRS: = faReadOnly else FileAttrs: = 0; if CheckBox2.Checked then FileAttrs: = FileAttrs faHidden; if CheckBox3.Checked then FileAttrs: = FileAttrs faSysFile; if CheckBox4.Checked then FileAttrs: = FileAttrs faVolumeID; if CheckBox5.Checked then FileAttrs : = FileAttrs faDirectory; if CheckBox6.Checked then FileAttrs: = FileAttrs faArchive; if CheckBox7.Checked then FileAttrs: = FileAttrs faAnyFile; if FindFirst (Edit1.Text, FileAttrs, sr) = 0 then begin with StringGrid1 do begin if (sr.attr and fileattrs) = sr.attr Then Begin Cells [1, RowCount-1]: = sr.Name; Cells [2, Row Count-1]: = INTTOSTR (sr.size); end; while findnext (sr) = 0 do begin if (sr.attr and fileattrs) = sr.attr the beginning; cells [1, Rowcount -1]: = sr.name; Cells [2, RowCount-1]: = INTTOSTR (sr.size); end; end; findclose (sr); end; end; end; ## Findfirst, Findnext, FindClose EXAMPLE- -------------------------------------------------- ------------------------- Findfirst Looking for the first unit. --------------- -------------------------------------------------- ------------ Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); Var Sr: TsearchRec; FileAtTRS: Integer;

begin StringGrid1.RowCount: = 1; if CheckBox1.Checked then FileAttrs: = faReadOnly else FileAttrs: = 0; if CheckBox2.Checked then FileAttrs: = FileAttrs faHidden; if CheckBox3.Checked then FileAttrs: = FileAttrs faSysFile; if CheckBox4. Checked then FileAttrs: = FileAttrs faVolumeID; if CheckBox5.Checked then FileAttrs: = FileAttrs faDirectory; if CheckBox6.Checked then FileAttrs: = FileAttrs faArchive; if CheckBox7.Checked then FileAttrs: = FileAttrs faAnyFile; if FindFirst (Edit1. Text, FileAtTRS, SR) = 0 THEN Begin with stringgrid1 do begin if (sr.attr and fileattrs) = sr.attr The begin Cells [1, Rowcount-1]: = sr.name; cells [2, RowCount-1] : = INTOSTR (Sr.Size); End; While FindNext (SR) = 0 Do Begin if (sr.attr and Fileattrs) = sr.attr The Begin Rowcount: = RowCount 1; Cells [1, Rowcount-1]: = Sr.Name; Cells [2, RowCount-1]: = INTOSTR (Sr.Size); End; findclose (sr); end; end; end; ## findfirst, findnext, findclose example ----------------------------- ----------------------------------------------- Findnext Next compliant file. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------- Unit sysutils function prototype Procedure FindClose (var f: tsearchrec); function prototype Function FindFirst (const Path: string; Attr: Integer; var F: TSearchRec): Integer; function prototype function FindNext (var F: TSearchRec): Integer; Description successfully returns 0. example var SRec: TSearchRec; procedure TForm1.SearchClick (Sender: TObject Begin Findfirst ('C: / Delphi / Bin /*.* ", FAANYFILE, SREC); Label1.caption: =

SREC.NAME 'IS' INTOSTR (SREC.SIZE) 'BYtes in size'; end; procedure tform1.againclick (sender: TObject); begin FindNext (SREC); label1.caption: = SREC.NAME 'IS ' IntToStr (SRec.Size) ' bytes in size '; end; procedure TForm1.FormClose (Sender: TObject); begin FindClose (SRec); end TSearchRec = record Time: Integer; size: Integer; Attr: Integer; Name : Tfilename; XCludeattr: Integer; FindHandle: Thandle; Finddata: Twin32Finddata; End; ================================== =========== Floating-point conversion Routines floating point number conversion function ============================= =============== floattodecimal converts floating point numbers to decimers .------------------------ -------------------------------------------------- --Unit sysutils function prototype Procedure Floattodecimal (Var Result: TfloatRec; const value; value; precimals: integer; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- ----- FLOATTOSTRF converts floating point numbers to formatted strings. ----------------------- -------------------------------------------------- ---- Unit sysutils function prototype Function FLOATTOSTRF (Value: Extended; Format: Tfloatformat; Precision, Digits: Integer: string;

-------------------------------------------------- -------------------------- FLOATTOSTR converts floating point numbers into strings. ------------------------------------------------------------------------------------------ -------------------------------------------------- ------------- Unit sysutils function prototype Function FLOATTOSTR (value: extended): string; ----------------------- -------------------------------------------------- ---- Floattotext converts floating point numbers to format ten into the top. ----------------------------------- ---------------------------------------- Unit sysutils function prototype Function Floattotext (Buffer : Pchar; Const value; valueTVE: TFLoAtValue; Format: Tfloatformat; PRECISION, DIGITS: Integer: Integer; ------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- FLOATTTEXTFMT converts floating point numbers to formatted ten into a place. ---------------------------------------- -------------------------------------- Unit sysutils function prototype Function floattotextFMT (Buffer: pchar; const Value; valueety; format: pchar): integer; ------------------------------------- --------------------------------------- FormatFloat converts floating point numbers to formatted strings . ----------- -------------------------------------------------- --------------- Unit sysutils function prototype Function Formatfloat (const format: string; value: extended): string; --------------- -------------------------------------------------- ------------ STRTOFLOAT converts strings into floating point numbers. ----------------------------- ---------------------------------------------- Unit sysutils Function prototype FUNCTION STRTOFLOAT (Const S: String): Extended; Example ProCedure TFORM1.BUTTON1CLICK (Sender: Tobject); var value: double; s: string; begin s: = '1234.56; value: = strand (s); label1 .Caption: = format ('converted to [% 9.3f]', [value]);

Note that if the S are string contains non-digital characters, an error signal will be generated. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------ TextTOFLOAT will null-terminated strings Convert to floating point. ------------------------------------------------------------------------- ------------------------------- Unit sysutils function prototype Function TEXTTOFLOAT (BUFFER: PCHAR; VARUE; VALUETYPE: TFLOATVALUE) : Boolean; =================================================== Flow-Control Routines Process control common ================================================== Break from for While, or review terminates out. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------- Unit System function prototype procedure break; example var s: string; begin while True do begin readln (s); tryness = 'Then Break; Writeln (s); Finally {do something for all case} end; end; end; --------------- -------------------------------------------------- ------------ Continue from For, While, or Repeat continues to execute. --------------------------- -------------------------------------------------- Unit System Function Prototype Procedure Continue; example var f: file; i: integer; begin for i: = 0 to (filelistbox1.items.count - 1) Do begin tryef filelistbox1.selected [i] the begin if not fileexists (fileElistbox1.items.strings " I]) THEN Begin Messagedlg ('file:' filelistbox1.items.strings [i] 'NOT FOUND', MTERROR, [MBOK], 0); Continue; End;

AssignFile (f, filelistbox1.items.strings [i]); reset (f, 1); ListBox1.Items.Add (INTTOSTR (FileSize (f))); CloseFile (f); end; finally {do something heren} end END; END; example var f: file; i: integer; begin for i: = 0 to (filelistbox1.items.count - 1) do begin tryefilelistbox1.selected [i] The begin if not fileexists (fileElistbox1.items . Strings [i]) The begin Messagedlg ('file:' filelistbox1.items.strings [i] 'Not Found', mTerror, [MboK], 0); Continue; End; AssignFile (f, FileListBox1.Items. Strings [i]); reset (f, 1); ListBox1.Items.Add (INTTOSTR (FileSize (f))); CloseFile (f); end; finally {do something;} end; end; end; ## Continue , Items, SELECTED EXAMPLE ------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------- EXIT directly left a program. ------------ -------------------------------------------------- --------------- Unit System Function prototype procedure exit; ------------ -------------------------------------------------- --------------- Halt end program returns the operating system. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ SYSTEM Function Prototype Procedure Halt [(EXITCODE: INTEGER)]; Sample Begin IF 1 = 1 Then Begin IF 2 = 2 Then Begin IF 3 = 3 THEN Begin Halt (1); {Halt Right Here!} End; end; Canvas.TextOut (10, 10, 'this will not be el);

-------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- --------------- Unit system function prototype procedure runerror [(ErrorCode: Byte)]; example begin {$ ifdef debug} if p = nil the runerror (204); {$ ENDIF} End; ==================================== ===================================================================================================================================================================== ============================================ assignfile specifies the file to a file variable. ------- -------------------------------------------------- ------------------- Unit System Function prototype procedure assignfile (VAR F; filename: string); Description ** A file cannot be repeatedly executed more than ASSIGNFILE .Examplevar F : Textfile; s: String; begin if OpenDialog1.execute kiln {display open dialog box} begin assignfile (f, openDialog1.filename); {file selected in dialog box} reset (f); readln (f, s); {readln (f, s); {readln The first line out of the file} edit1.text: = s; {PUT STRING IN A Tedit Control} Closefile (F); end; end; ## AssignFile, OpenDialog, Readln, Closefile Example -------------------------------------------------------------------------------------------------------------------- --------------------------------------------- Closefile Close the file. -------------------------------------------------- -------------------------- Unit System Function Prototype Procedure Closefile (VAR F);

#### Assignfile, OpenDialog, Readln, CloseFile Example ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------------------------------- iResult Retrieving the latest I / O function, Is there a mistake. ---------------------------------------------- ------------------------------ Unit System function prototype Function ioreSult: integer; example var f: file of byte; s: String; begin s: = 'c: /ka/aaa.txt'; assignfile (f, s); {$ I-} reset (f); {$ i } if ioresult = 0 THEN Label1.caption: = 'File SIZE IN BYTES: ' INTOSTR (FileSize (f); Else Label1.caption: =' Opening Failed '; END; Description Transfer 0 means no errors .Examplevar f: file of byte; begin if OpenDialog1.execute thrilers (F, OpenDialog1.FileName); {$ I-} reset (f); {$ I } if ioresis = 0 Then Messagedlg ('File Size In Bytes:' INTOSTR (FileSize (f)), Mtinformation, [Mbok] , 0) Else Messagedlg ('File Access Error', MTWARNING, [Mbok], 0); End; End; ------------------------- -------------------------------------------------- --Reset starts a file available case.------------------------------------------------ ----------------------------- Unit System Function Prototype Procedure Reset (VAR F [: File; RecSize: Word]); -------------------------------------------------- ------------------------ ReWrite builds a new file available for write. -------------------------------------------------------------------------- -------------------------------------------------- ------------- Unit system function prototype Procedure Rewrite (var f: file [; recsize: word]); sample procedure tform1.button1click (sender: TOBJECT); var f: textfile; i1, I2, I3: Integer; S1, S2, S3: String; Begin I1: = 1234; I2: = 5678; I3: = 90; S1: = 'Abcd'; S2: = 'EFGH'; S3: = 'IJ' Assignfile (f, '

C: /ka/aaa.txt '); ReWrite (f); Write (f, i1); Write (f, i2); Write (f, I3); Write (f, s1); Write (f, s2) Write (f, s3); Write (F, I1, I2, I3); WRITE (F, S1, S2, S3); Writeln (F, I1); Writeln (F, I2); Writeln (f, i3) Writeln (f, s1); Writeln (f, s2); Writeln (f, s3); Writeln (F, I1, I2, I3); WRITELN (F, S1, S2, S3); reset (f); Readln (F, S1); Readln (F, I1); Label1.caption: = S1 '' INTOSTR (I1); Closefile (f); end; Result 1234567890abcdefghij1234567890abcdefghij1234 .. 5678 .. 90 .. abcd .. Efgh .. Ij .. 1234567890 .. Abcdefghij .. Abcdefghij .. The above is the archive result, two representatives # 13 # 10, two bits. Archiflow by Writeln, multiple wrap symbols # 13 # 10. And if WriteLn (f , I1, I2, I3) will be as the same string column, there is no interval symbol between variables, causing the expected effect when READ is caused. Read Results S1 = 1234567890ABCDEFGHIJ1234567890ABCDEFGHIJ1234 length 44 and does not include # 13 # 10 two bits. I1 = 5678 ** Write (f, i1: 10: 2, i2: 8: 2); Formatted features, like Str. Example Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); var f: file of byte; I1, I2, I3: BYTE; Begin I1: = 16; I2: = 32; I3: = 48; AS Signfile (f, 'c: /ka/aaa.txt'); REWRITE (F); Write (f, i1); Write (f, i2); Write (f, i3); Write (f, i1, i2, I3); I1: = 0; reset (f); read (f, i1); label1.caption: = INTOSTR (I1); Closefile (f); end; Result File Of Byte and File of Record can only be Write and READ, to write and read, not Writeln and Readln. Example Procedure TFORM1.BUTTON1Click (Sender: TOBJECT); type pprec = Record PP_NO: String [5]; pp_name: string [10]; pp_age: integer; pp_sum: Double; end; var r: pPRec; REC2: pPRec; f: file of pprec; begin with rec do beg, pp_no: = '0001'; pp_name: = 'abc'; pp_age: = 12; PP_SUM: = 600;

AssignFile (f, 'c: /ka/aaa.txt'); REWRITE (F); Write (f, REC); REC.pp_no: = '0002'; Rec.pp_sum: = 58.2; Write (f, rec) Rec.pp_no: = '0003'; Rec.pp_sum: = 258.242; Write (f, REC); Seek (f, 1); Read (f, REC2); SEEK (f, 1); truncate (f); {Delete, only 0 pen} canvas.textout (5, 10, rec2.pp_no); canvas.textout (5, 30, REC2.pp_name); Canvas.Textout (5, 50, Format ('% d', [REC2.PP_AGE])); canvas.textout (5, 70, Format ('% f', [REC2.pp_sum])); CloseFile (f); end; Result PP_NO Deposit 6 bytes PP_NAME Deposit 11 Bytes PP_age Deposit 4 bytes (Integer 4 Bytes) PP_SUM Deposit 8 Bytes (Double 8 Bytes) The entire Record is archived in 16 multiples .Examplevar f: TextFile; Begin AssignFile (f, 'newfile. $$$ "; REWRITE (f) Writeln (f, 'Just Created File with this text in it ...); Closefile (f); end; ----------------------- -------------------------------------------------- ---- SEEK mobile archive indicator. ----------------------------------------- ------------------------------------ Unit system function prototype Procedure Seek (VAR f; N: longint) Description Seek starts from 0 .examplevar F : File of byte; size: long; s: string; y: integer; begin if OpenDialog1.execute1 begin assignfile (f, openDialog1.filename); reset (f); size: = filesis (f); s: = ' FILE SIZE IN BYTES: ' INTOSTR (SIZE); Y: = 10; Canvas.Textout (5, Y, S); Y: = Y Canvas.TextHeight (s) 5; s: =' Seeking Halfway Into File ... '; canvas.textout (5, y, s); y: = y canvas.textheight (s) 5; seek (f, size div 2); s: =' Position is now ' INTOSTR Filepos (f)); canvas.textout (5, y, s); Closefile (f); end; end;

## FileSize, Seek, Filepos Example ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---------------------------------- Truncate removes all the files after the current archive indicator location. - -------------------------------------------------- ------------------------- Unit system function prototype procedure truncate (var f); sample var f: file of integer; i, j: integer; Begin AssignFile (F, 'Test.int'); ReWrite (f); for i: = 1 to 6 do Write (f, i); Writeln ('File Before Truncation:'); Reset (f); While NOT EOF (f) Do Begin READ (F, I); Writeln (I); end; reset (f); for i: = 1 to 3 do read (f, j); {read ahead 3 records}}; {Cut file off here}; writeln; reset (f); While Not Eof (f) Do Begin READ (F, I); Writeln (I); End; CloseFile (f); ERASE (f); end; ------------------------------------------- ---------------------------------- Filepos back to the current position of the current file. -------- -------------------------------------------------- ------------------- Unit system function prototype Function Filepos (VAR f): LO NGINT Note F Can't for the TEXT FILE DIT: FilePos (f): = 0; Runar: EOF (f): = true; example var f: file of byte; s: string; begin s: = 'c: / ka /Abc.txt '; assignfile (f, s); reset (f); seek (f, 1); label1.caption: =' Current location: ' INTOSTR (FilePos (f)); end; examplevar f: file Of Byte; Size: Longint; String; Y: Inteder; Begin if OpenDialog1.execute1 Begin AssignFile (f, OpenDialog1.FileName); reset (f); size: = filesize (f); s: = 'File Size In Bytes: ' INTOSTR (SIZE); Y: = 10; Canvas.Textout (5, Y, S); Y: = Y Canvas.TextHeight (s) 5; s: =' Seeking Halfway Into File .. . ';

Canvas.TextOut (5, y, s); y: = y canvas.textheight (s) 5; seek (f, size div 2); s: = 'position is now' INTOSTOSTR (FilePos (f)) Canvas.TextOut (5, y, s); Closefile (f); end; end; ## filesis, seek, filepos example --------------------- -------------------------------------------------- ------ FileSize archive length. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------- Unit system function prototype Function FileSize (VAR f): integer; Note f cannot be a record file if f is a record file, otherwise it will return the number of BYTE. ## FileSize, seek, filepos example -------------------------------------- -------------------------------------------------- --------- EOF test files end. ----------------------------------- ---------------------------------------- Unit system function prototype Function Eof (VAR F): boolean; function prototype FUNCTION EOF [(VAR f: text)]: boolean; example var f1, f2: textfile; ch: char; begin if OpenDialog1.execute dam assignfile (F1, OpenDialog1.FileName); reset F1); if Savedialog1.execute THEN B Egin AssignFile (F2, OpenDialog1.FileName); ReWrite (F2); While Not Eof (F1) DO Begin Read (F1, CH); Write (F2, CH); End; Closefile (F2); End; Closefile (F1) ; end; end; Examplevar F1, F2: TextFile; Ch: Char; begin if OpenDialog1.Execute then begin AssignFile (F1, OpenDialog1.Filename); Reset (F1); if SaveDialog1.Execute then begin AssignFile (F2, SaveDialog1.Filename ReWrite (F2); While Not Eof (f1) DO Begin Read (F1, CH); Write (F2, CH); End; Closefile (F2); End; Closefile (F1); end; end;

-------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- --------- // SavePictureDialog1.DefaultExt: = GraphicExtension (TBitmap); // SavePictureDialog1.Filter: = GraphicFilter (TBitmap); procedure TForm1.Button1Click (Sender: TObject); var Done: Boolean; begin OpenPictureDialog1 .DefaultExt: = GraphicExtension (TIcon); OpenPictureDialog1.FileName: = GraphicFileMask (TIcon); OpenPictureDialog1.Filter: = GraphicFilter (TIcon); OpenPictureDialog1.Options: = [ofFileMustExist, ofHideReadOnly, ofNoChangeDir]; while not Done do begin if OpenPictureDialog1. Execute then begin if not (ofExtensionDifferent in OpenPictureDialog1.Options) then begin Application.Icon.LoadFromFile (OpenPictureDialog1.FileName); Done: = True; end else OpenPictureDialog1.Options: = OpenPictureDialog1.Options - ofExtensionDifferent; end else {User cancelled} Don E: = true; end; end; ## eof, read, write example --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------- Erase deletes files. -------------------------------------------------- ------------------------- Unit system function prototype procedure ERASE (VAR f); Description You must implement it first. Example Procedure TFORM1. Button1Click (Sender: TObject); var F: Textfile; begin OpenDialog1.Title: = 'Delete File'; if OpenDialog1.Execute then begin AssignFile (F, OpenDialog1.FileName); try Reset (F); if MessageDlg ( 'Erase' OpenDialog1.FileName '?', MTConfirmation, [mbyes, mbno], 0) = mryes dam closefile (f); ERASE (f); end;

Except ON EinouTerror Do Messagedlg ('File I / O Error.', MTERROR, [MBOK], 0); End; End; End; EXAMPLEPROCEDURE TFORM1.BUTTON1CLICK (Sender: Tobject); var f: TextFile; begin OpenDialog1.title: = 'Delete File'; if OpenDialog1.Execute then begin AssignFile (F, OpenDialog1.FileName); try Reset (F); '?' if MessageDlg ( 'Erase' OpenDialog1.FileName , mtConfirmation, [mbYes, mbNo], 0) = MRYES THEN BEGIN Closefile (f); ERASE (f); End; Except ON Error. ', MTERROR, [Mbok], 0); end; end; end; ## ERASE, OpenDialog.Title, OpenDialog.FileName Example ---------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------- Rename Change the name .-------- -------------------------------------------------- ------------------- Unit System Function Prototype Procedure Rename (var F; NewName); Sample Uses Dialogs; Var f: File; Begin OpenDialog1.title: = 'Choose A File ... '; if OpenDialog1.execute the b egin SaveDialog1.Title: = 'Rename to ...'; if SaveDialog1.Execute then begin AssignFile (f, OpenDialog1.FileName); Canvas.TextOut (5, 10, 'Renaming' OpenDialog1.FileName 'to' SaveDialog1 .Filename); Rename (f, savedialog1.filename); end; end; end; example; begin openDialog1.title: = 'choose a file ...'; if OpenDialog1.execute dam Savedialog1 .1. Title: = 'RENAME TO ...'; if Savedialog1.execute1 Begin AssignFile (f, OpenDialog1.FileName); Canvas.Textout (5, 10, 'Renaming'

OpenDialog1.filename 'to' savedialog1.filename; rename (f, savedialog1.filename); end; end; end; ---------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ----- GetDir passed the directory of the specified disk. ----------------------------------- ----------------------------------------- Unit System Function prototype Procedure getDir (D : Byte; var s: string; Description D 0 = Current drive, 1 = A disk, 2 = B disk machine ... ** This function does not check the disk machine error. Example Var S : String; Begin getdir (0, s); {0 = current drive} messagedlg ('Current Drive and Directory:' S, Mtinformation, [Mbok], 0); END; ---------- -------------------------------------------------- ---------------- MKDIR build subdirectory. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ System function prototype procedure MkDir (S: string); example uses Dialogs; begin {$ I-} {Get directory name from TEdit control} MkDir (Edit1.Text); if IOResult <> 0 then MessageDlg ( 'Can not create directory', MTWARNING, [Mbok], 0) Else Messagedlg ('New Directory Created', Mtinformation, [Mbok], 0); End; -------------------------------------------------------------------------------- ------------------------------------------- RMDIR Delete an empty Subdibree. ----------------------------------- ----------------------------- Unit System Function Prototype Procedure RMDIR (S: String); Sample Uses Dialogs; Begin {$ I -} {Get directory name from TEdit control} RmDir (Edit1.Text); if IOResult <> 0 then MessageDlg ( 'Can not remove directory', mtWarning, [mbOk], 0) else MessageDlg ( 'Directory removed', mtInformation, [ Mbok], 0);

-------------------------------------------------- -------------------------- CHDIR changes current catalog. ------------------ -------------------------------------------------- --------- Unit System Function Prototype Procedure Chdir (S: String); Example Begin {$ I-} {Change To Directory Specified in Edit1} Chdir (Edit1.Text); if ioressult <> 0 Then Messagedlg ('Cannot Find Directory', MTWARNING, [Mbok], 0); End; ================================= ============== Memory-management routines memory management Circular =========================== =================== Allocmem configure memory. ---------------------------------------------------------------------------------------------------- -------------------------------------------------- -Unit sysutils function prototype Function Allocmem (size: cardinal): Pointer; Description FreeMem releases memory. ----------------------------- ---------------------------------------------- GetHeapStatus Back to the current memory configuration status of the HEAP area. ------------------------------------------------------------------------------------------------------------------ ------------------------------------- Unit System function prototype Function GetHeapStatus: theapstatus; ---- -------------------------------------------------- ----- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- --------- Unit System function prototype procedure GetMemoryManager (var MemMgr: TMemoryManager); EXamplevar GetMemCount: Integer; FreeMemCount: Integer; ReallocMemCount: Integer; OldMemMgr: TMemoryManager; function NewGetMem (Size: Integer): Pointer;

begin Inc (GetMemCount); Result: = OldMemMgr.GetMem (Size); end; function NewFreeMem (P: Pointer): Integer; begin Inc (FreeMemCount); Result: = OldMemMgr.FreeMem (P); end; function NewReallocMem (P : Pointer; Size: Integer): Pointer; begin Inc (ReallocMemCount); Result: = OldMemMgr.ReallocMem (P, Size); end; const NewMemMgr: TMemoryManager = (GetMem: NewGetMem; FreeMem: NewFreeMem; ReallocMem: NewReallocMem); procedure Setnewmemmgr; begin getMemoryManager (OldMemMgr); setMemoryManager (newMemmgr); end; ## getMemoryManager, setMemoryManager Example --------------------------- ----------------------------------------------- Reallocmem Re- Configure memories. ------------------------------------------------ ------------------------------- Unit Systems Function Prototype Procedure Reallocmem (var P: Pointer; SIZE: Integer; -------------------------------------------------- ------------------------- SetMemoryManager Sets the entry point of the memory configuration of the HEAP area. ----------- -------------------------------------------------- --------------- Unit System Function Prototype PROC edure SetMemoryManager (const MemMgr: TMemoryManager); type THeapStatus = record TotalAddrSpace: Cardinal; s TotalUncommitted: Cardinal; TotalCommitted: Cardinal; TotalAllocated: Cardinal; TotalFree: Cardinal; FreeSmall: Cardinal; FreeBig: Cardinal; Unused: Cardinal; Overhead: Cardinal; HeapErrorCode: Cardinal; end; type PMemoryManager = ^ TMemoryManager; TMemoryManager = record GetMem: function (Size: Integer): Pointer; FreeMem: function (P: Pointer): Integer; ReallocMem: function (P: Pointer; Size: Integer): Pointer; End; Examplevar GetMemcount: Integer; FreeMemcount: Integer; ReallocMemcount: Integer; Oldmemmgr: TMemoryManager;

function NewGetMem (Size: Integer): Pointer; begin Inc (GetMemCount); Result: = OldMemMgr.GetMem (Size); end; function NewFreeMem (P: Pointer): Integer; begin Inc (FreeMemCount); Result: = OldMemMgr.FreeMem (P); end; function NewReallocMem (P: Pointer; Size: Integer): Pointer; begin Inc (ReallocMemCount); Result: = OldMemMgr.ReallocMem (P, Size); end; const NewMemMgr: TMemoryManager = (GetMem: NewGetMem; FreeMem: NewFreeMem; ReallocMem: NewReallocMem); procedure SetNewMemMgr; begin GetMemoryManager (OldMemMgr); SetMemoryManager (NewMemMgr); end; ## GetMemoryManager, SetMemoryManager Example =================== =================== miscellaneous routines Other current type ========================== ============ Exclude deletes an element in a set of elements. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------ System Function Prototype Procedure Exclude (Var S: Set of T; i: T); Description I Elements in the deletion of S. ------------------------ -------------------------------------------------- --- Fillchar fill in the elements. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------- --------------------------- Unit System Function prototype Procedure Fillchar (VAR X; Count: Integer; Value); Description Fill in Value COUNT. Sample Examplevar S: Array [0..79] of char; begin {set to all spaces} fillchar (s, sizeof (s), ORD ('')); Messagedlg (S, Mtinformation, [Mbok ], 0);

-------------------------------------------------- -------------------------- Hi back the high-level number. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- --------- Unit System Function Prototype Function Hi (x): Byte; Example Var B: Byte; Begin B: = Hi ($ 1234); {$ 12} end; ------- -------------------------------------------------- -------------------- Include Add to a set of elements. --------------------- -------------------------------------------------- ----- Unit System Function Prototype Procedure Include (var s: set of t; i: t); Description Add I element to s. ----------------- -------------------------------------------------- ---------- LO Retrieves the high level number. --------------------------------- ------------------------------------------ Unit system function prototype Function LO (X): Byte; example var B: byte; begin B: = LO ($ 1234); {$ 34} end; -------------------------------------------------------------------------------------------- -------------------------------------------------- --- Move from the source variable copy n Bytes to the purpose of interest. ----------------------------------- ----------------------------------------- Unit System Function prototype Procedure Move (VAR SO Urce, DEST; Count: Integer; Example Var A: Array [1..4] of char; b: integer; begin move (A, B, SIZEOF (B)); {sizeof = safty!} End; -------------------------------------------------- ------------------------- paramcount directly by the number of incoming variables after the executive file. (Arj.exe a Dr.arj D: * * ----------------------------------- ----------------------------- Unit System Function prototype Function paramcount: Integer; Description If the above example, the 3examplevar I: Integer is returned; ListItem: String; Begin for i: = 0 to ibQuery1.Paramcount - 1 Do Begin ListItem: = ListBox1.items [i]; Case Ibquery1.Params [i] .DataType of fTString: ibQuery1.Params [i] .sstring: = ListItem; ftsmallint: ibQuery1.Params [i] .ssmallint: =

StrtointDef (ListItem, 0); ftinteger: ibQuery1.Params [i] .asinteger: = startdef (ListInTitem, 0); ftword: ibQuery1.Params [i] .asword: = startdef (ListItem, 0); ftboolean: Begin if ListItem = 'True' Then Ibquery1.Params [i] .asboolean: = true else ibQuery1.Params [i] .asboolean: = false; end; ftfloat: ibQuery1.Params [i] .asfloat: = struploat (ListIt); ftcurrency: IbQuery1.Params [i] .ascurrency: = strup iaserry1.params [i] .asbcd: = straopcurr (ListItem); ftdate: ibQuery1.Params [i] .asdate: = strtodate (ListItem); fttime : IBQuery1.Params [I] .AsTime: = strToTime (ListItem); ftDateTime: IBQuery1.Params [I] .AsDateTime: = StrToDateTime (ListItem); end; end; end; ## ParamCount, DataType, StrToIntDef, AsXXX Example- -------------------------------------------------- -------------------------- PARAMSTR ----------------------- ----------- ------------------------------------------- Unit system function prototype Function Paramstr INDEX: Integer: String; Description Paramstr (0); Replies the name and full directory of the execution file. (C: /zip/arj.exe) Example VAR i: Word; Y: Integer; begin y: = 10; for I: = 1 to Paramcount Do Begin Canvas.TextOut (5, Y, Paramstr (I)); Y: = Y Canvas.TextHeight (paramstr (i)) 5; end; end; exampleprocedure TFORM1.FormCreate (Sender: TOBJECT); VAR i: integer; for i: = 0 to paramcount -1 do begin if lowercase (paramstr (i)) = 'Beep' Then Windows.beep (10000, 1000) Else IF (LowerCase (PARAMSTR (i)) = 'Exit' the application.terminate; end;

## paramcount, paramstr example -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------- Random Number --------------- -------------------------------------------------- ------------ Unit System Function Prototype Function Random [(Range: Integer)]; Description 0 <= x

-------------------------------------------------- -------------------------- Upcase converts a word to uppercase letters. ------------- -------------------------------------------------- -------------- Unit System Function Prototype Function Upcase (CH: Char): Char; Sample Uses Dialogs; Var S: String; I: Integer; Begin {Get String from Tedit Control} S : = Edit1.text; for i: = 1 to length (s) do s [i]: = Upcase (s [i]); messagedlg ('Here it is in all uppercase:' s, mtinformation, [mbok] , 0); End; EXAMPLEVAR S: STRING; I: Inteder; begin {get string from tedit control} s: = Edit1.Text; for i: = 1 to length (s) do if i mod 2 = 0 THEN S [ I]: = Upcase (s [i]); edit1.text: = S; end; =============================== ============== ORDINAL ROUTINES sequence current =============================== =========== DEC makes the variable decrease. ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------ Unit System Function prototype Procedure Dec ( Var x [; n: longint]); Description DEC (x) ==> x: = x-1; dec (x, n) ==> x: = xn; Example Var Intvar: in Teger; longintvar: = 10; longintvar: = 10; DEC (intvar); {Intvar: = intvar - 1} DEC (longintvar, 5); {longintvar: = longintvar - 5} end;

-------------------------------------------------- --------------------------- Inc to increase the variables. ------------------ -------------------------------------------------- --------- Unit System Function Prototype Procedure Inc (VAR X [N: Longint]); Description INC (X) ==> x: = x-1; Inc (x, n) ==> X: = xn; example var intvar: integer; longintvar: longint; begin inc; {intvar: = intvar 1} inc (Longintvar, 5); {longintvar: = longintvar 5} end; ---- -------------------------------------------------- ---------------------- ODD check is odd. --------------------- -------------------------------------------------- ----- Unit system function prototype Function ODD (x: longint): boolean; ExampleBegin if odd (5) Then Canvas.TextOut (10, 10, '5 is ODD.') Else Canvas.Textout (10, 10 , 'Something is odd!'); End; ======================================== Pointer and address routines location constant ================================================== The location of an object. ---------------------------------------------------------------------------------------------------------------------- -------------------------------- Unit SYSTEM function prototype Function addr (x): Pointer; Examplevar i: integer; nodenumbers: array [0 .. 100] of integer; begin with treeview1 do begin for i: = 0 to items.count - 1 do begin nodenumbers [i] : = CalculateValue (items [i]); items [i] .data: = addr (nodenumber [i]); end; end;

-------------------------------------------------- --------------------------------------------------------- -------------------------------------------------- ------------ Unit System Function Prototype Function Assigned (VAR P): Boolean; Description When @ p = nil ==> Back False Example VAR P: ​​Pointer; Begin P: = NIL; if Assigned (P) Then Writeln; GetMem (p, 1024); {p valid} FreeMem (P, 1024); {P no longer valid and still NIL} if Assigned (P) THEN WRITELN ('you'll see'); End =================================== String- Formatting Routines string format =============================================== -------------------------------------------------- --------------------- FMTSTR (Var Strresult: string; const format: string; constrays: array of string; --------- -------------------------------------------------- ----------------- Format: string; const args: array of string: string; --------------- -------------------------------------------------- ---- ------- Unit sysutils function prototype Procedure FMTSTR (var Result: string; const format: string; const array of; function format (const format: string; const args: array of const): String Description% D: integer% E: scientific type% F: fixed point real% g: real number% N: real number (-d, ddd, ddd.dd ...)% M: Money format% P: POINT% S: word String% x: HEX example var i: integer; j: double; s: string; t: string; begin t: = format ('

% D% 8.2F% s', [i, j, s]); listbox1.item.add (t); end; bubbleSeries1.percentformat: = '## 0.0 #%'; exampleprocedure tform1.table1afterdelete (DataSet: TDataSet Begin statusbar1.simpletext: = format ('there is% d records in the table ", [dataset.recordcount]); end; s: = format (' 1-? ???????????????????????????????????????? ???? -% d, 2-? -% D, 3-? -% d ', [10, 20, 30]); Format ('% *. * F ', [9, 2, 12345.6789]) Format ('% 9.2f', [12345.6789]); Format ('% 3D,% D,% 0: D,% 2: -4d,% d', [1, 2, 3, 4]); ' 1, 2, 1, 3, 4 '# 淘 =======================================================================================00★ ===== String-handling routines (pascal-style) word letter ================================= ======= Ansicomparestr compares the size of the two strings. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------- AnsicompareText (AnsiCompareText this item is not case sensitive). ---------------------------------------------------------------------------------------------------------------------- ------------------------------------- Unit Sysutilsvars1, S2: String; i: integer; begins1: = 'A ????'; s2: = '?????'; i: = CompareStr (S1, S2); {i = 0,?.?. S1 = S2} if i = 0 THEN Messagedlg (S1, '=', S2, MTWARNING, [Mbok], 0); END; Function Prototype Function AnsiCompareStr (Const S1, S2: String): Integer; Function Prototype Function AnsiCompareText (Const S1 , S2: String): integer;

-------------------------------------------------- -------------------------- AnsilowerCase transfers all strings to lowercase letters. According to the installation of Language Driver. ------- -------------------------------------------------- -------------------- ANSIUPPERCASE converts the string to uppercase letters. LANGUAGE DRIVE is installed ------------- -------------------------------------------------- ------------ Unit sysutils function prototype Function AnsilowerCase (const s: string): string; function prototype Function AnsiUppercase (const s: string): string; ---------- -------------------------------------------------- ---------------- CompareStr compares the size of the two strings. ------------------------ -------------------------------------------------- --- CompareText (CompareText This item is not case sensitive). ---------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- Unit sysutils function prototype FUNCTION COMPARESTR (Const S1 , S2: String): Integer; Function Prototype Function CompareText (const S1, s2: string): integer; sample var string1, string2: string; i: integer; begin string1: = 'steve'; string2: = 'steve'; I: = CompareStr (String1, String2); {i <0} if i <0 Then Messagedlg ('string1

The OnCompare event handler causes the list view to sort on the selected column: procedure TForm1.ListView1Compare (Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer); var ix: Integer; begin if ColumnToSort = 0 THEN Compare: = compareText (item1.caption, item2.caption) else begin ix: = column = compareter - 1; Compare: = compareText (item1.subitems [ity], item2.subitems [ix]); end; end; ## oncolumnclick , AlphaSort, oncompare, CompareText Example ---------------------------------------------------------------------------------------------------------------------------------- -------------------------------- CONCAT will add the string .--------- -------------------------------------------------- ----------------- Unit System Function Prototype Function Concat (S1 [, S2, ..., SN]: String: String; Description & S: = S1 S2 S3 ...; Same. Example Var S: String; Begin S: = Concat ('ABC', 'DEF'); {'Abcde'} end; var s: string; begin s: = '?' ' ???? ' ' ???????? ?????? '; s: = concat ('? ',' ???? ',' ???????? ?? ???? '); //? ????? ??????? s: ='? ???? ???????? ?????? 'end; ---------------- -------------------------------------------------- ---------------------------------------------------------------------------------------------------------- -------------------------------------------------- --Unit system function prototype Function Copy (S: String; Index, Count: integer): String; Description S: String. Indexd: From the first few positions. COUNT: Total copies. Example var s: string Begin s: = 'Abcdef'; s: = COPY (S, 2, 3); {'bcd'} end; ---------------- Var s: string; begin S: = '??????'; s: = COPY (S, 3, 4); // s: = '????' end; ------------- --Exampleprocedure TFORM1.COMBOBOX1KEYPRESS (Sender: Tobject; Var Key: char);

var Found: boolean; i, SelSt: Integer; TmpStr: string; begin {first, process the keystroke to obtain the current string} {This code requires all items in list to be uppercase} if Key in [ 'a' .. ' Z '] THEN DEC (Key, 32); {force Uppercase Only!} with (Sender As Tcombobox) Do Begin Selst: = SELSTART; IF (Key = CHR (VK_BACK)) and (SelLength <> 0) THEN TMPSTR: = Copy (Text, 1, Selstart) Copy (Text, Sellength SELSTART 1, 255) Else if key = chr (vk_back) THEN {SELLENGTH = 0} TMPSTR: = Copy (Text, 1, SELSTART-1) COPY , SELSTART 1,255) Else {key in ['a' .. 'z', etc]} Tmpstr: = COPY (Text, 1, SELSTART) Key Copy (Text, Sellength SELSTART 1, 255); if tmpstr = 'TEN EXIT; {UPDATE SELST TO THE CURRENT INSERTION POINT} IF (Key = Chr (vk_back)) and (selst> 0) THEN DEC (SELST) ELSE IF KEY <> CHR (VK_BACK) THEN INC (SELST); Key: = # 0; {INDICATE THAT = 0 THEN BEGIN TEXT: = '; exit; end; {now That TMPSTR IS The Currently Typed STR ING, SEE IF WE CAN LOCATE A MATCH} Found: = false; for i: = 1 to items.com [i-1], 1, length (tmpstr)) = tmpstr1 begin text: = items [i-1]; {Update to the match That Was Found} ItemIndex: = I-1; Found: = true; Break; End; if Found the {Select the untyped end of the string} begin selstart: = SELST; SELLENGTH : = Length (text) -Selst; end else beep; end; end; ----------------------- procedure tComponiteTeditor.copy; var AFORMAT: WORD; Adata, APALETTE: THANDLE;

Begin With Component As Timage Do Begin Picture.SavetoclipboardFormat (AFORMAT, Adata, Apalette); Clipboard.Setashandle (AFORMAT, Adata); End; End; ## Copy, Chr, Selstart, Sellength Example --------- -------------------------------------------------- ------------------ DELETE deletes several characters in the string. --------------------- -------------------------------------------------- ---- Unit System Function Prototype Procedure Delete (INDEX, Count: Integer); Description S: String. INDEXD: From the first few bits Start Delete. Count: Total to delete. Example VAR String; begin s: = 'honest abe lincoln'; delete (s, 8, 4); canvas.textout (10, 10, s); {'honest lincoln'} end; var s: string; begin s: = '???????, ??????, ??????????!'; Delete (s, 8, 1); // s: = '????? ?? ??????, ??????????! 'Messagedlg (S, MTWARNING, [Mbok], 0); end; -------------- -------------------------------------------------- ------------ NewStr Configuring a new string space in HEAP to pstring metrics. ---------------------------------------------------------------------------- -------------------------------------------------- ----- DisposeStr in Heap Release a string space pstring indicator. --------------------------------------------------------------------------------------- ----------------------------------- Unit sysutils function prototype Function Newstr (const s: string): pstring Function prototype Procedure DisposeStr (P: pstring); Description S: String. PString: New string indicator. Example Var P: pstring; s: string; begin s: = 'ask me About blaise'; p: = newstr (S); Disposestr (P): End; ------------------------------------- ------------------------------------- Insert Insert a sub-string into another string . -------------------------------------------------- --------------------------- Unit System Function prototype procedure insert (Source: String; var s: string; index: integer); Description Source: Sub string. S: The mother character string being inserted. Indexd: Insert from the first few digits. Example Var s: String;

Begin s: = 'honest Lincoln'; INSERT ('Abe', S, 8); {'honest Abe lincoln'} end; var s: string; begin s: = '?????? ???? ?? ??????????. '; INSERT ('! ', S, 8); {s: =' ???????! ?????? ????? ?????. '} Messagedlg (s, mtwarning, [mbok], 0); end; --------------------------- -------------------------------------------------- INTTOHEX will turn int to HEX. ------------------------------------------------------------------------------------------------------------------- ---------------------------------- Procedure TFORM1.B /BUTTON1CLICK (Sender: Tobject); VAR i: integer; begin Label1.caption: = '; for i: = 1 to length (edit1.text) do begin try Label1.caption: = label1.caption INTTOHEX (edit1.text [i], 4) ' '; Except Beep; End End; end; exam: edit2.text: = (strt "), 6); --------------------------- -------------------------------------------------- INTSTR will turn int to str. ------------------------------------------- ---------------------------------- Procedure TFORM1.B /BUTTON1CLICK (Sender: TOBJECT); begin try Label1.caption: = INTSTR (STRT) Oint (edit1.text) * StrtOINT (edit2.text)); Except ShowMessage ('You Must Specify Integer Values); End; End; -------------- -------------------------------------------------- ------------ - Strtoint converts STR to int. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------- procedure TFORM1. Button1Click (Sender: TOBJECT); VAR I: Integer; J: Integer; Begin i: = strt (edit1.text); J: = STRTOINT (Edit2.Text); showMessage (INTTOSTR (i j));

-------------------------------------------------- -------------------------- STRTOINTDEF converts STR to int. When the conversion is incorrect, it passes back the value of the default. --- -------------------------------------------------- ------------------------ Unit sysutils function prototype Function INTTOHEX (Value: Integer; Digits: integer): string; function prototype Function INTOSTR (Value: Integer : String; Function prototype FUNCTION STRTOINT (const S: string): integer; function prototype Function Strtointdef (const: integer): Integer; Description Value: Integer to convert. Digits: To convert to several digits Examples of Hex procedure TForm1.Button1Click (Sender: TObject);. begin Edit2.Text: = IntToHex (StrToInt (Edit1.Text), 6); end; procedure TForm1.Button1Click (Sender: TObject); var Value: Integer; begin Value: = 1234; Edit1.Text: = INTOSTR (Value); End; Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); var s: string; i: integer; begin s: = '22467'; i: = start (s ); Inc (i); edit1.text: = INTOSTR (i); end; procedure tform1.button1click (sender: Tobject); var NumberString: string; Number: Integer; begin NumberString: = Edit1.Text; Number: = StrToIntDef (NumberString, 1000); Edit2.Text: = IntToStr (Number); end; Examplevar I: Integer; ListItem: string; begin for I : = 0 to query1.Paramcount - 1 Do Begin ListItem: = listbox1.items [i]; case query1.params [i] .DataType of ftstring: query1.params [i] .sstring: = ListItem; ftsmallint: query1.params [I] .ssmallint: = startDef (Listitem, 0); ftinteger: query1.params [i] .asinteger: = startdef (ListItem, 0); ftword: query1.params [i] .asword: = startdef (ListItem, 0 );

FTBOOLEAN: Begin if listitem = 'True' Tan query1.params [i] .asboolean: = true else query1.params [i] .asboolean: = false; end; ftfloat: query1.params [i] .asfloat: = StrtOfloat ( Listitem); ftcurrency: query1.params [i] .ascurrency: = start (ListItem); ftbcd: query1.params [i] .asbcd: = stratocurr (ListItem); ftdate: query1.params [i] .asdate: = strtodate (ListItem); fttime: query1.params [i] .astime: = strtotime (ListItem); ftdatetime: query1.params [i] .asdatetime: = strandatetime (ListItem); end; end; end; ------ -------------------- Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); var number: integer; begin number: = startdef (edit1.text, 1000); edit2. TEXT: = INTOSTR (Number); end; ------------------- ## paramcount, datatype, startdef, asxxx eXample ----------- -------------------------------------------------- --------------------------------------------------------------------------------- ----- ------------------------------------ System Function Prototype Procedure Str (x [: width [: Decimals]; Var S); Description X: Integer OR implementation. Width: Format The length. (Integer) Decimals: Decimal point number. (Integer) Makeitastring: String; {Convert Any Integer Type to a string} var s: string [11]; begin STR (i, s); makeitastring: = s; end; begin canvas.textout (10, 10, Makeitastring (-5322)); End; ----------------------------------------- ----------------------------------- VAL converts the strings into numbers. -------- -------------------------------------------------- --------------------- Unit system function prototype Procedure Val (s; var var code: integer);

Description S: String of wants to convert. V: The integer OR implementation after conversion. Code: code = 0 Indicates the success of the conversion. Semini Uses Dialogs; Var I, Code: integer; begin {get text from tedit control} val (Edit1. Text, i, code); {Error During conversion to integer?} If code <> 0 Then Messagedlg ('Error At Position:' INTOSTOSTR (CODE), MTWARNING, [MBOK], 0); Else Canvas.Textout (10 , 10, 'Value =' INTOSTR (I)); Readln; End; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------- Length string length. -------------------------------------------------- --------------------------- Unit System Function Prototype Function Length: Integer; Description S: String to convert. Example Var S: String; Begin S: = 'THE Black Knight'; Canvas.TextOut (10, 10, 'String Length =' INTOSTR (Length (s))); End; ExampleProcedure TFORM1.BUTTON1CLICK (Sender: TOBJECT) Var i: integer; begin label1.caption: = '; for i: = 1 to length (edit1.text) do beg, try label1.caption: = label1.caption INTTOHEX (edit1.text [i] , 4) ''; EndPt Beep; End; End; End; Example Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); VARS: String; Begin S: = MEMO1.TEXT; label1.caption: = ' INTOSTR (Length " (S)); End; Vars: String; I: integer; begins: = '? ???? ???????? ??????'; i: = length (s); // I: = 22Messagedlg ('????? ?????? =' INTOSTR (I), MTWARNING, [Mbok], 0); End; ## length, INTTOHEX EXAMPLE -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ------------------- POS Looking for the position in the mother character string. ---------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ------- Unit System Function Prototype Function Pos (Substr: String;

S: String): INTEGER; Description Substr: Sub string. S: Master string. Square procedure tForm1.button1click (sender: TOBJECT); var s: string; begin s: = '1234.5'; {Convert Spaces to zeroes} While POS ('', s)> 0 DO S [POS ('', s)]: = '0'; label1.caption: = S; label1.font.size: = 16; end; var s: string; I: integer; begin s: = '? ???? ????????? ???????; i: = POS (' ??? ', s); // i: = 3nd ; // Demo 001234.50 // Blank word string repair ------------------------------------------------------------------------------------------------------------------------------------ --------------------------------------- LowerCase will transfer all strings to lowercase letters. -------------------------------------------------- -------------------------- Unit System Function prototype Function LowerCase: String; Sample Procedure TFORM1.BUTTON1CLICK (Sender: Tobject Begin Edit2.Text: = LowerCase (edit1.text); End; ExampleProcedure TFORM1.BUTTON1CLICK (Sender: Tobject); begin label1.caption: = LowerCase (Edit1.Text); end; var s: string; begin s: = LowerCase ('????????. Txt'); // s: = '????????. Txt'end; ------------ -------------------------------------------- ------------------- Uppercase will turn the string to uppercase letters. --------------------- -------------------------------------------------- ---- - Unit sysutils function prototype Function Uppercase: String; Sample Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); Var i: integer; begin for i: = 0 to listbox1.items.count - 1 Do ListBox1.items [I]: = Uppercase (ListBox1.items [i]); End; ExampleProcedure TFORM1.BUTTON1CLICK (Sender: Tobject); var i: integer; begin for i: = 0 to listbox1.items.count - 1 Do ListBox1.Items [I]: = Uppercase (ListBox1.Items [i]);

-------------------------------------------------- -------------------------- Trim clears the blank and control character before and after the strings .trim (const s: string): String Sysutilsvar s: string; l: integer; begins: = # 13 '???!' # 13; l: = length (s); // L: = 10s: = trim (s); // s: = '???!' L: = l-length (s); // L: = 5MESSAGEDLG ('??????? ???????? -' INTOSTOSTR (L), Mtinformation, [ Mbok], 0); End; ------------------------------------------ ---------------------------------- Trimleft clears the blank and control character to the left side of the strings. Sysutilsvars : String; l: integer; begins: = # 13 '???!' # 13; l: = length (s); // L: = 10s: = trimleft (s); // s: = '?? ?! '# 13L: = l-length (s); // L: = 3MESSAGEDLG (' ??????? ???????? - ' INTOSTOSTR (L), Mtinformation, [Mbok] , 0); END; -------------------------------------------- -------------------------------- Trimright clears the blank and control character on the right side of the strings .--- -------------------------------------------------- ------------------------ Unit sysutils function prototype Function Trim (const s: string): String; Function prototype Function Trimleft (const s: string): Strin g; function prototype Function Trimright (const S: string): string; Vars: string; l: integer; begins: = # 13 '???!' # 13; l: = length (s); // l: = 10 s: = trimright (s); // s: = # 13 '???!' L: = l-length (s); // L: = 2 messagedlg ('??????? ?? ?????? - ' INTOSTR (L), Mtinformation, [Mbok], 0); End; ------------------------- -------------------------------------------------- --AdjustLineBreaks all change the string of wrap symbols all changed # 13 # 10 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------ Unit sysutils function prototype Function AdjustLineBreaks Const s: string: String; =======

========================================================================================================================================================== ===========================================stralloc configuration string space. -------------- -------------------------------------------------- ----------------- Unit sysutils function prototype Function Stralloc (size: cardinal): pchar; Description Size = String Max Space 1 ---------- -------------------------------------------------- ----------------- strbufsize passed the size of the STRALLOC configuration space ---------------------- -------------------------------------------------- --- Unit sysutils function prototype Function strbufsize (str: pchar): cardinal; --------------------------------- ------------------------------------------ STRCAT string is added. -------------------------------------------------- -------------------------- Unit sysutils function prototype Function Strcat (DEST, SOURCE: PCHAR): PCHAR; Sample Uses sysutils; const Obj: PCHAR = 'Object'; Pascal: PCHAR = 'PASCAL'; var S: array [0..15] of char; begin strcopy (s, obj); strcat (s, ''); strcat (s, pascal); Canvas.TextOut (10, 10, StrPas (s)); end; Exampleprocedure TForm1.Button1Click (Sender: TObject); var Buffer: PChar; begin GetMem (Buffer, Length (Label1.Caption) Length (Edit1.Text) 1); StrCopy (Buffer, PChar (Label1.Caption)) , Strcat (buffer, pchar (edit1.text)); label1.caption: = buffer; edit1.clear; freemem (buffer); end; const p0: pchar = '?????? -'; p1: pchar = '??????????'; p2: pchar = '????????';

Var S1, S2: Array [0..20] of char; begin strcopy (S1, P0); Strcopy (S2, P0); STRCAT (S1, P1); {S1: = '?????? ?????????? '} strcat (S2, P2); {S2: =' ?????? - ???????? '} messagedlg (S1 # 13 S2, Mtinformation, [Mbok], 0); End; ## strcopy, strcat example ----------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ------------------------- Unit sysutils function prototype Function strcomp (str1, str2: pchar): integer; example uses sysutils; const s1: pchar = 'WACKY'; S2: PCHAR = 'code'; var C: Integer; Result: string; begin C: = STRComp (S1, S2); IF c <0 Then Result: = 'is less' else IF c> 0 THEN RESULT: = 'Is Greater Than' Else Result: = 'Is Equal to'; Canvas.Textout (10, 10, StrPas (S1) Result StrPas (S2)); End; Exampleuses Sysutils; Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); VAR MSG: String; CompResult: Integer; Begin Msg: = Edit1.Text; Compresult : = Strcomp (pchar (edit1.text), pchar (edit2.text)); if Compresult <0 THEN MSG: = MSG 'Is Less Than' Else IF Compresult> 0 THEN MSG: = MSG 'Is Greater Than' Else msg: = msg 'is equal to' msg: = msg edit2.text; showMessage (msg); end; var s1, s2: pchar; i: integer; res: string; begin s1: = 'company'; S2: = 'Company'; i: = STRComp (S1, S2); if i> 0 THEN RES: = '>' Else I <0 Then Res: = '<' else res: = '='; messagedlg S1 RES

S2, MTINFORMATION, [Mbok], 0); End; ------------------------------------- ------------------------------------------- -------------------------------------------------- --------------------- Unit sysutils function prototype Function Strcopy (DEST, SOURCE: PCHAR): PCHAR; example Uses sysutils; var s: array [0 .. 12] of char; begin strcopy (s, 'objectpascal'); canvas.textout (10, 10, strpas (s)); end; exampleprocedure tform1.button1click (sender: TOBJECT); var buffer: pchar; begin getMem (Buffer Length (label1.caption) length (edit1.text) 1); strcopy (buffer, pchar (label1.caption)); strcat (buffer, pchar (edit1.text)); label1.caption: = Buffer; Edit1 .Clear; freem (buffer); end; ## strcopy, strcat example ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------ STRDISPOSE Release Stralloc or Strnew configured Space.----------------------------------------------- ----------------------------- Unit sysutils function prototype procedure strdispose (str: pchar); example uses sysutils; const s: pchar = 'Nevermore'; var P: pchar; begin p: = strnew (s); canvas.textout (10, 10, strpas (p)); strdispose (p); end; ---------- -------------------------------------------------- ----------------- Strecopy copy string and pass back the string end location. -------------------- -------------------------------------------------- ----- Unit sysutils Function Prototype Function Strecopy (DEST, SOURCE: PCHAR): PCHAR; Sample Uses sysutils; const turbo: pchar = 'object'; pascal: pchar = 'pascal'; var s: array [0 ..15] of char; becom stres (strecopy (STRecopy (S, Turbo), ''), PASCAL); Canvas.TextOut (10, 10, StrPas (s)); end; exampleUses sysutils; const turbo: pchar = 'Object';

Pascal: pchar = 'pascal'; var s: array [0..15] of char; ber; start (STRecopy (S, Turbo), ''), PASCAL); Canvas.TextOut (10, 10, String) S)); END; -------------------------------------------- -------------------------------- Strend Password end address. -------- -------------------------------------------------- ------------------ Unit sysutils function prototype Function Strend (str: pchar): PCHAR; Sample Uses sysutils; const s: pchar = 'Yankee Doodle'; Begin Canvas. Textout (5, 10, 'THE STRINGTH OF "' STRPAS (S) '" IS' INTTOSTR (STREND (S) - S)); End; ExampleProcedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); VAR TEXTBUFFER: PCHAR; PTR: PCHAR; Begin getmem (TextBuffer, length (edit1.text) 1); strcopy (TextBuffer, pchar (edit1.text)); ptr: = streven; label1.caption: = '; while PTR > = TEXTBUFFER Do Begin PTR: = PTR? 1; Label1.caption: = Label1.caption Ptr ^; End; FreeMem (TextBuffer); End; Var Str: Pchar; L: Word; Begin ... l: = strend (STR) - STR; ... END; ---------- -------------------------------------------------- ----------------- Stricomp compared the two string sizes. (Case of casements) -------------------- -------------------------------------------------- ------- Unit sysutils function prototype Function Stricomp (str1, str2: pchar): integer; example Uses sysutils; const S1: pchar = 'WACKY'; S2: PCHAR = 'code'; var C: Integer; Result : String; Begin C: = StriComp (S1, S2); IF C <0 Then Result: = 'is Less Than' Else IF C> 0 Then Result: = 'Is Greater Than' Else Result: = 'Is Equal To' Canvas.TextOut (10, 10, StrPas (S1)

Result StrPas (S2)); end; xampleuses SysUtils; procedure TForm1.Button1Click (Sender: TObject); var Msg: string; CompResult: Integer; begin Msg: = Edit1.Text; CompResult: = StrIComp (PChar (Edit1.Text ), Pchar (edit2.text)); if compresult <0 THEN MSG: = MSG 'Is Less Than' Else IF Compresult> 0 THEN MSG: = MSG 'Is Greater Than' Else Msg: = MSG 'Is Equal To 'msg: = msg edit2.text; showMessage (msg); end; var s1, s2: pchar; i: integer; res: string; begin s1: =' abc '; s2: =' abc '; i: = StriComp (S1, S2); {i: = 0,?.?. S1 = S2} if i> 0 THEN RES: = '>' else IF i <0 Then Res: = '<' else res: = ' = '; Messagedlg (S1 RES S2, MTINFORMATION, [Mbok], 0); End; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------ Strlcat String is added. (Designation length) ----------------------------------------- ----------------------------------- Unit sysutils function prototype Function Strlcat (DEST, SOURCE: PCHAR; MAXLEN : Cardinal: Pchar; paragraph Uses sysutils; var s: array [0 .. 13] OF Char; Begin Strlcopy (S, 'Object', SizeOf (s) - 1); Strlcat (S, '', SIZEOF (S) - 1); Strlcat (S, 'Pascal', SizeOf (s) - 1); Canvas.TextOut (10, 10, strpas (s)); End; ExampleProcedure TFORM1.BUTTON1CLICK (Sender: Tobject); var firsthalf: pchar; secondhalf: pchar; halflen: integer; begin halflen: = strlen (pchar) Edit1.text) Div 2; getMem (Firsthalf, Halflen 2); getMem (Secondhalf, Halflen 2); firsthalf ^: = chr (0); secondhalf ^: = chr (0); strlcat (firsthalf, pchar) Edit1.text), Halflen;

StrCat (SecondHalf, PChar (Edit1.Text) HalfLen); Application.MessageBox (FirstHalf, 'First Half', MB_OK); Application.MessageBox (SecondHalf, 'Second Half', MB_OK); FreeMem (FirstHalf); FreeMem (SecondHalf ); END; const S1: PCHAR = '???'; s2: pchar = '?????????'; var s: array [0..13] of char; becom strlcopy (S, S1 Strlen (S1)); strlcat (s, s2, 6); {s: = '??????'} messagedlg (s, mtinformation, [mbok], 0); end; ## strln, strlcat example -------------------------------------------------- ---------------------------------------------------------------------------------- -------------------------------------------------- --------------- Unit sysutils function prototype Function strlcomp (str1, str2: pchar; maxlen: cardinal): integer; example uses sysutils; const S1: pchar = 'Enterprise' s2: pchar = 'Enter' Var Result: String; Begin IF Strlcomp (S1, S2, 5) = 0 Then Result: = 'Equal' Else Result: = 'DIFFERENT'; Canvas.Textout (10, 10, 'The First Five Characters Are ' Result); End; Exam Pleuses sysu on; Canvas.TextOut (10, 10, 'The first Five Characters Are' COMSTR); END; const S1: pchar = '?????????'; s2: pchar = '??????? ? '; var i: integer; s: string; begin i: = 5; if strlcomp (S1, S2, I) = 0 THEN S: =' ????? 'else s: =' ????? ??? '; messagedlg (' ?????? ' INTOSTOSTR (i) ' ???????? ????? '

S, Mtinformation, [Mbok], 0); END; ------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- -------------------------- Unit sysutils function prototype Function strlcopy (dest, source: pchar; maxlen: cardinal): PCHAR; example Uses sysutils; Var s: Array [0..11] of char; begin strlcopy (s, 'objectpascal', sizeof (s) - 1); canvas.textout (10, 10, strpas (s)); end; exampleus sysutils; const MAX_BUFFER = 10; procedure TForm1.Button1Click (Sender TObject); var Buffer: array [0..MAX_BUFFER] of char; begin StrLCopy (Buffer, PChar (Edit1.Text), MAX_BUFFER); Application.MessageBox (Buffer, 'StrLCopy Example ', MB_OK); End; var s: pchar; begin strlcopy (s,' ???????? ', 5); {s: =' ????? '} ... End; -------------------------------------------------- ---------------------------------------------------------------------------------- -------------------------------------------------- ----------------- Unit sysutils function prototype Function Strlen (S Tr: pchar): cardinal; example uses sysutils; const s: pchar = 'e pluribus uniform'; begin canvas.textout (5, 10, 'the string length of "' strpas (s) '" is' INTOSTR (Strlen (s))); End; ExampleProcedure TFORM1.BUTTON1CLICK (Sender: Tobject); var firsthalf: pchar; secondhalf: pchar; halflen: integer; begin halflen: = strlen (pchar (edit1.text)) Div 2; getMem (Firsthalf, Halflen 2); GetMem (Secondhalf, Halflen 2); firsthalf ^: = chr (0); secondhalf ^: = chr (0); strlcat (firsthalf, pchar (edit1.text), halflen; strcat (Secondhalf, Pchar (edit1.text) Halflen; Application.MessageBox (Firsthalf, 'First Half', MB_OK);

Application.MessageBox (Secondhalf, 'Second Half', MB_OK); FreeMem (Secondhalf); FreeMem (Secondhalf); end; const S: pchar = '??????????????????????????????????????????????????????????? ?????! '; begin Messagedlg (s # 13 # 10 ? ?????????????????? =' INTSTR (Strlen (s)), Mtinformation, [ Mbok], 0); End; ## strlcat example ---------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- Strlicomp compares the two string sizes. (Specified Long, regardless of case) ----------------------------------------------------------------------------------------------------------------- -------------------------------- Unit sysutils function prototype Function Strlicomp (str1, str2: pchar; maxlen: cardinals : Integer; paragrace Uses sysutils; const S1: pchar = 'Enterprise' s2: pchar = 'Enter' Var Result: String; Begin IF Strlicomp (S1, S2, 5) = 0 THEN Result: = 'Equal' else Result: = 'DIFFERENT'; Canvas.TextOut (10, 10, 'THE FIRST FIVE CHARACTERS Are' Result); End; ExamplyUses System; Const S1: Pchar = 'Enterprise' S2: Pchar = 'Enter'var Comstr: String; Begin IF strlicomp (S1, S2, 5) = 0 THEN COMSTR: = 'E QUAL 'Else Comstr: =' DIFFERENT '; Canvas.TextOut (10, 10,' The First Five Characters Are ' Comstr); End; Const S1: PCHAR =' ????????? '; S2: PCHAR = '????????'; var s: string; Begin IF Strlicomp (S1, S2, 5) = 0 THEN S: = '?????' Else S: ​​= '???? ???? '; messagedlg (S1 # 13 S2 # 13 ' ?????? ' INTOSTR (i) ' ???????? ????? S, Mtinformation, [Mbok], 0); END;

-------------------------------------------------- -------------------------- Strlower will turn all strings to lowercase letters. ------------- -------------------------------------------------- -------------- Unit sysutils function prototype Function strlower (str: pchar): pchar; example uses system; const s: pchar = 'a funny string' Begin Canvas.Textout (5, 10 STRPAS (Strlower (s)) '' Strpas (Strupper (s))); end; --------------------------- -------------------------------------------------- Strmove causes the source string to copy n bytes to the climbing R string. (Excluding the termination chamber) ------------------------------------------------------------ ------------------------------------ SysUtils function prototype function StrMove (Dest, Source: PChar; Count: Cardinal): PChar; example uses SysUtils; function AHeapaString (S: PChar): PChar; {Allocate string on heap} var L: Cardinal; P: PChar; begin strNew : = NIL; IF (S <> nil) and (s [0] <> # 0) THEN BEGIN L: = Strlen (s) 1; getMem (p, l); strnew: = strmove (p, s, L); end; end; procedure disposedaString (s: pchar); {Dispose String On Heap} Begin IF S <> NIL THEN FreeMem (S, Strlen (S) 1); End; var s: pchar; begin aheapastring (s); Disposedastring (s); end; var s1, s2: PCHAR; Begin S1: = 'Abcdefgh'; Strmove (S2, S1, Strlen (S1) 1); strlower (S1); {S1: = 'Abcdefgh'} Strupper (S2); {S2: = 'Abcdefgh'} Messagedlg (S1 # 13 # 10 S2, Mtinformation, [Mbok], 0); End; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------ Strnew Configuration string space. --------------------------------------------- ------------------------------ Unit sysutils function prototype Function Strnew (str: pchar): PCHAR;

Exampleuses Sysutils; procedure TForm1.Button1Click (Sender: TObject); var Temp: PChar; begin // Allocate memory Temp:. = StrNew (PChar (Edit1.Text)); Application.MessageBox (Temp, 'StrNew, StrDispose Example', MB_OK); // deallocate memory. STRDISPOSE (TEMP); END; const S: pchar = '??????????? ??????; var snew: pchar; begin SNEW: = strnew (S); messagedlg ('s:' s # 13 'snew:' snew, mtinformation, [mbok], 0); strdispose (SNEW); end; ## strnew, strdispose example ----- -------------------------------------------------- ---------------------- StrPas turn the null-terminated string to the pascal-style string. ------------- -------------------------------------------------- -------------- Unit sysutils function prototype Function StrPas (str: pchar): string; example Uses sysutils; const A: pchar = 'i love the smell of object pascal in the morning.' VAR S: String [79]; begin s: = strpas (a); canvas.textout (10, 10, s); {Note That The Following Also Works} canvas.textout (10, 10, a); end; ---- -------------------------------------------------- -------------------------------------------- -------------------------------------------------- -------------- Unit sysutils function prototype Function Strpcopy (DEST: PCHAR; Source: string): PCHAR; Sample Uses sysutils; var A: array [0..79] of char; s : String; begin s: = 'Honk if you know blaise.'; Strpcopy (a, s); Canvas.Textout (10, 10, StrPas (a)); end; var source: string; dest: array [0. .20] of char; begin Source: = '???????? ??????'; StrPCopy (DEST, SOURCE); Messagedlg (DEST, MTINFORMATION, [MBOK], 0);

-------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- --------------------- Unit sysutils function prototype Function Strplcopy (dest: pchar; const source: string; maxlen: cardinal: pchar; ----- -------------------------------------------------- ---------------------- StrPos Sub strings in the maternal string. (1 position) ---------- -------------------------------------------------- ----------------- Unit sysutils function prototype Function Strpos (str1, str2: pchar): pchar; Description Str1 mother string str2 sub-string EXAMPLEUSES SYSUTILS; Procedure TFORM1.BUTTON1CLICK Sender TOBJECT); VAR LOCATION: Pchar; Begin IF Strpos (Pchar (Edit1.Text), Pchar (Edit2.Text)) <> NIL THEN SHOWMESSAG ('Substring Not Found'); END; ------------------ Const Substr: pchar = 'www'; var s, r: pchar; begin s: = 'http://www.ausssk.ru/delphi / '; R: = Strpos (s, substr); if r <> nil damagedlg (r, mtinformation, [MBO K], 0) Else Messagedlg ('?? ????????? ?????? URL!', mTerror, [Mbok], 0); End; --------- -------------------------------------------------- --------------------------------------------- -------------------------------------------------- ------------ Unit sysutils function prototype Function STRSCAN (Str: pchar; chr: char): pchar; example {Return Pointer to Name Part of a full path name} uses system; function namepart (filename "; function namepart (filename"; function namepart (filename); function namepart (FileName); FUNCTION NAMEPART (FILENAME) : Pchar; pchar; var p: pchar; begin p: = STRRSCAN (filename, '/'); if p = nil dam p: = STRRSCAN (filename, ':'); if p = nil the p: = Filename; end; namepart: = p;

Var s: string; begin s: = strpaas (namepart ('c: /test.fil')); canvas.textout (10, 10, s); end; const s: pchar = 'myfile.zzz'; var r : Pchar; begin r: = STRRSCAN (S, '.'); {R: = '.zzz'} Messagedlg (r, mtinformation, [mbok], 0); END; ---------- -------------------------------------------------- --------------------------------------------------- -------------------------------------------------- ----- Unit sysutils function prototype Function Strscan (str: pchar; chr: char): PCHAR; example Uses sysutils; function Haswildcards (filename: pchar): boolean; {return true if file name HAS Wildcards in it} begin HaswildCards: = (STRSCAN (FileName, '*') <> nil) or (FileName, '?') <> Nil); end; const p: pchar = 'c: /test.*'; begin if Haswildcards (P) Then Canvas.TextOut (20, 20, 'The string Has Wildcards') Else Canvas.TextOut (20, 20,' THE STRING DOESN'T HAVE WILDCARDS ') end; const S: pchar =' http: // Www.atrussk.ru '; var r: pchar; begin R: = STRSCAN (S, 'W'); {r: = 'www.assagedlg (r, mtinformation, [mbok], 0); END; ------------- -------------------------------------------------- -------------- Strupper will turn the string to uppercase letters. ------------------------------------------------------------------------------------------------------ -------------------------------------------------- -Unit sysutils function prototype Function Strupper (str: pchar): PCHAR; Sample Uses sysutils; const s: pchar = 'a funny string' Begin Canvas.Textout (5, 10, StrPas (Strlower (s)) '' StrPas (STRUPPER (S))); end; ==================

=========================================================================================================================================================== ======================= Appended a file available for Append. ----------------- -------------------------------------------------- --------- Unit System Function Prototype Procedure Append (var f: Text); Sample VAR F: TextFile; Begin IF Open File Dialog} Begin AssignFile (f, OpenDialog1.FileName ); {Open file selected in dialog} append (f); {add more text onto end} WriteLn (f, 'appended text'); Closefile (f); {Close File, Save Changes} End; End; Examplevar F: TextFile; begin if OpenDialog1.execute thr} {Open a text file} assignfile (f, opendialog1.filename); append (f); Writeln (f, 'i am appending some stuff to the end of the file.'); { INSERT CODE Here That Would Require A Flush Before Closing The File} Flush (f); {ENSURES THAT THE TEXT WAS ACTUALLLY WRITTEN TO File} Closefile (f); end; end; ## append, flush eXample ------ - -------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ------- Unit System Function Prototype Function Eoln [(VAR F: Text)]: Boolean; Flush puts the data in buffer into disk. (For text file) Unit system function prototype Procedure Flush (VAR F: text); example var f: textfile; begin if OpenDialog1.execute thr f {Open a text file} assignfile (f, opendialog1.filename);

Append (f); Writeln (f, 'I am appending some stuff to the end.'); Flush (f); {ENSURES That THET WALLY Written to file} {INSERT CODE Here That Would Require A Flush Before closing the file} closefile (f); end; end; examplebegin {tells program to wait for keyboard infut} WriteLn (eoln); END; ------------------- -------------------------------------------------- -------- Read the reading. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- Unit System Function Prototype Procedure Read (f, V1 , V2, ..., VN]); Procedure Read ([VAR F: Text;] V1 [, V2, ..., VN]); example Uses Dialogs; Var F1, F2: TextFile; CH: char; begin if OpenDialog1.Execute then begin AssignFile (F1, OpenDialog1.Filename); Reset (F1); if SaveDialog1.Execute then begin AssignFile (F2, OpenDialog1.Filename); Rewrite (F2); While not Eof (F1) do begin Read ( F1, CH); Write (F2, CH); end; Closefile (F2); end; closefile (f1); end; end. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ------------------------ Unit system function prototype Procedure Readln ([VAR f: text;] V1 [, v2, ..., vn]) Example VAR S: String; Begin Write ('Enter a line of text:'); readln (s); writeln ('you type:', s); Writeln ('Hit to EXIT'); Readln; End; ---------------------------------------------------------------- ------------------------------------------- -------------------------------------------------- ------------ Unit system function prototype Function seekeof [(var f: text)]: boolean

Sample var f: system.textfile; i, j, y: integer; begin assignfile (f, 'test.txt'); REWRITE (f); {crete a file with 8 NumBers and some whitespace at the ends of the lines} Writeln (f, '1 2 3 4'); Writeln (f, '5 6 7 8'); reset (f); {read the number back. Seekeoln Returns True If there is no more numbers on the current line; seekeof Returns True if there is no more text (other than whitespace) in the file.} y: = 5; While Not Seekeof (f) Do Begin if Seekeoln (f) Then Readln; {Go To Next Line} Read (f, J ); Canvas.textout (5, y, inttostr (j)); y: = y canvas.textheight (INTTOSTR (j)) 5; end; end; ----------- -------------------------------------------------- -------------- SEEKEOLN test files end. ----------------------------- ---------------------------------------------- Unit System Function prototype Function seekeoln [(VAR f: text)]: boolean; Examplevar f: System.TextFile; i, j, y: integer; begin assignfile F, 'Test.txt'); ReWrite (f); {Create a file with 8 NumBers and some whitespace at the ends of the line} Writeln (f, '1 2 3 4'); Writeln (f, '5 6 7 8 '); reset (f); {read the number back. Seekeoln Returns True IF The current line; seekeof returns True if there is no more text (Other TETESPACE) in the file.} Y : = 5; While Not Seekeof (f) Do Begin if Seekeoln (f) Then Readln; {Go To Next Line} Read (f, J); Canvas.Textout (5, Y, INTOSTR (J)); Y: = Y canvas.textheight (INTTOSTR (j)) 5; end; end;

## SeeKeoln, Seekeof Example ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------------------------- setTextBuf Specifies I / O Buffer to Text File. ------- -------------------------------------------------- ------------------- Unit System Function Prototype Procedure SetTextBuf (var buf [; size: integer]); paragrace Uses Dialogs; Var F, FTWO : System.textfile; ch: char; buf: array [1..4095] of char; {4k buffer} begin if OpenDialog1.execute thr (f, paramstr (1)); {BIGGER BUFFER for Faster Reads} setTextBuf (F, BUF); Reset (f); {Dump text file {dump text file {, {dump, 'woof.dog'); REWRITE (FTWO); While Not Eof (f) Do Begin Read (F, CH); Write (fTwoch); end; system.closefile (f); system.closefile (ftwo); end; end; ------------------------- -------------------------------------------------- - Write is written to the file. ------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------- UNI T system function prototype Write (f, v1, ..., vn); Write ([var f: text;] p1 [, p2, ..., pn]); Procedure TFORM1.BUTTON3CLICK (Sender: Tobject); VAR Stream: TBlobStream; S: string; begin with Table1 do begin Edit; Stream: = CreateBlobStream (FieldByName ( 'Notes'), bmReadWrite); try Stream.Seek (0, 2); {Seek 0 bytes from the stream's end point} S: = 'this line will be added to the end.'; Stream.write (pchar (s), length (s)); finally stream.free; end; post; end; end; ------- -------------------------------------------------- -------------------- WriteLn Write into the file. ------------------------- -------------------------------------------------- --Unit system function prototype Procedure Writeln ([VAR F: text)

] P1 [, P2, ..., PN]); example var s: string; begin write; readln (s); writeln ('you type:', s); Writeln ('Hit to EXIT'); Readln; End; ====================================== ==== Transfer Routines conversion group ======================================= CHR will Byte is converted to the character. ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------- Unit system function prototype Function Chr (x: byte): char; example begin Canvas .Textout (10, 10, chr (65)); {The letter 'a'} end; ExampleProcedure TFORM1.COMBOBOX1KEYPRESS (Sender: Tobject; var key: char); Var Found: Boolean; i, selst: integer; tmpstr: String; begin {first, process the key} {this code required} {this code}} l ['a' .. 'z'] THEN DEC (key, 32); {force Uppercase only!} With (sender as tcombobo) DO begin selst: = sleelstart; if (key = chr (vk_back)) and (sellength <> 0) THEN TMPSTR: = Copy (Text, 1, SELSTART) COPY (Text, SELLENGTH SELST Art 1,255) Else if key = chr (vk_back) THEN {SelLength = 0} Tmpstr: = Copy (Text, 1, SELSTART-1) COPY (Text, SELSTART 1, 255) Else {key in ['a' .. 'Z', etc]} Tmpstr: = COPY (Text, 1, SELSTART) Key Copy (Text, SelLength SELSTART 1, 255); if Tmpstr = 'Then EXIT;

{Update selst to the current insertion point Point} IF (key = chr (vk_back)) and (selst> 0) THEN DEC (SELST) ELSE IF Key <> chr (vk_back) THEN INC (SELST); key: = # 0; {INDICATE THAT = 0 THEN BEGIN TEXT: = '; EXIT; End; {Now That Tmpstr Is The Currently TMPSTR IS The Currently Typed String, See IF We can locate a match} Found: = false; for i: = 1 To items.count do if copy (items [i-1], 1, length (tmpstr)) = tmpstr kilin text: = items [i-1]; {update to the match "{update to the match" {Update to the match "{UPDATE to THATHT THAT WAS FOUND} ItemIndex: = i- 1; Found: = true; Break; end; if found of the string} begin selstart: = selst; sellength: = length (text) -Selst; end else beep; end; end; ## Copy , CHR, SELSTART, SELLENGTH EXAMPLE -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------- HIGH passes the maximum value. -------- -------------------------------------------------- ----------------- Unit system function prototype Functio N high (x); example [Ordinal Type] Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); var low_s: string; high_s: string; s: string; begin high_s: = 'high =' INTOSTR (High (Word)) ; Low_s: = 'Low =' INTOSTR (Low (Word)); s: = low_s high_s; label1.caption: = S; end; s: = low = 0 high = 65535 [array type] procedure tForm1.button1click (Sender: TOBJECT); VAR P: ​​Array [5..21] of double; low_s: string; high_s: string; s: string; begin high_s: = 'high =' INTOSTR (high (p)); low_s: = 'Low =' INTOSTR (Low (p)); s: = low_s high_s;

Label1.caption: = S; end; s: = low = 5 high = 21 [String Type] procedure tform1.button1click (sender: TOBJECT); var P: string; high_s: string; s: String; begin high_s: = 'high =' INTOSTR (high (p)); low_s: = 'Low =' INTOSTR (Low (P)); s: = low_s high_s; label1.caption: = S; END ; S: = LOW = 0 hight = 23 p: shortstring; s: = low = 0 hight = 255 p: string; long strings can not, there will be error signals. [Open array] function sum (Var x: Array of Double : Double; var i: word; s: double; begin s: = 0; {Note That Open array index range is always zero-based.} For i: = 0 to high (x) do s: = s x [I]; sum: = S; End; ExampleFunction sum (var x: array of double): double; var i: word; s: real; begin s: = 0; {Note That Open Array Index Range is always zero- Based.} for i: = 0 to high (x) do s: = s x [i]; sum: = s; end; procedure tform1.button1click (sender: TOBJECT); var list1: array [0..3 ] Of double; list2: array [5..17] of double; x: Word; s, Tempstr: s TRING for x: = LOW (LIST1) TO HIGH (LIST1) Do List1 [x]: = x * 3.4; for x: = low (list2) to high (list2) do list2 [x]: = x * 0.0123 Str (SUM (List1): 4: 2, s); s: = 'sum of list1: s # 13 # 10; s: = s ' sum of list2: '; str (SUM (SUM (LIST2) : 4: 2, tempstr); S: = S Tempstr; Messagedlg (S, Mtinformation, [MboK], 0); End; ## low, high example -------------- -------------------------------------------------- ------------- LOW back to the minimum. ----------------------------- ---------------------------------------------- Unit System Function Prototype Function Low (X);

Description Ordinal type The lowest value in the range of the type Array type The lowest value within the range of the index type of the array String type Returns 0 Open array Returns 0 String parameter Returns 0 ----------- -------------------------------------------------- ------------------------------------------------------------------------ -------------------------------------------------- - UNIT System Function Prototype Function ORD (X): Longint; Example Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); Type Colors = (Red, Blue, Green); var s: string; begin s: = 'Blue Has An Ordinal Value of ' INTOSTR (ORD (RED)) # 13 # 10; s: = S ' THE ASCII Code for "C" IS ' INTOSTR (ORD (' C ')) ' Decimal '; Messagedlg (S, Mtinformation, [Mbok], 0); End; --------------------------------------- -------------------------------------- Round will turn the real number to an integer. (Have four rounds into) - -------------------------------------------------- -------------------------- Unit System Function Prototype Function Round (x: Extended): Longint; Example VA R S, T: String; Begin Str (1.4: 2: 1, t); s: = T 'ROUNDS to' INTSTR (Round (1.4)) # 13 # 10; STR (1.5: 2: 1, T); s: = S T 'ROUNDS to' INTOSTR (Round (1.5)) # 13 # 10; STR (-1.4: 2: 1, t); s: = S T 'Rounds to ' INTOSTR (Round (-1.4)) # 13 # 10; STR (-1.5: 2: 1, t); s: = S T ' ROUNDS to ' INTTOSTR (Round (-1.5)); messagedlg (S, mtinformation, [mbok], 0);

-------------------------------------------------- -------------------------- Trunc turns the real number into an integer. (Decimate directly) ----------- -------------------------------------------------- --------------- Unit System Function Prototype Function Trunc (x: Extended): Longint; Untyped File Routinesvar S, T: String; Begin Str (1.4: 2: 1, t) ; S: = T 'truncs to' INTOSTR (Trunc (1.4)) # 13 # 10; STR (1.5: 2: 1, t); s: = S T 'Truncs To' INTOSTR (Trunc (1.5)) # 13 # 10; STR (-1.4: 2: 1, t); s: = S T 'Truncs to' INTOSTR (Trunc (-1.4)) # 13 # 10; STR -1.5: 2: 1, t); s: = S T 'Truncs to' INTOSTR (Trunc (-1.5)); Messagedlg (S, Mtinformation, [MboK], 0); end; ---- --------------------- VAR F: File of Integer; I, J: Integer; Begin Assignfile (f, 'Test.int'); Rewrite (f) For i: = 1 to 6 do Write (f, i); Writeln ('file before truncation:'); reset (f); While Not Eof (f) Do Begin Read (f, i); Writeln (i) ; End; RESET (F); for i: = 1 to 3 do read (f, j); {read ahead 3 records} {ie Cut file off he}; writeln ('file after truncation:'); reset (f); While Not Eof (f) Do Begin Read (f, i); Writeln (i); end; closefile (f); ERASE (f); End; -------------------------------------------- ------------------------------- BLOCKREAD reads the file to memory block. ------- -------------------------------------------------- -------------------- Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); Var fromf, TOF: File; Numread, Numwritten: Integer; BUF: Array [1 .. 2048] OF CHAR; Begin if OpenDialog1.execute Then {Opening Dialog} Begin Assignfile (fromf, OpenDialog1.FileName);

{} Reset (FromF, 1); {Record size = 1} if SaveDialog1.Execute then {Display Save dialog box} begin AssignFile (ToF, SaveDialog1.FileName); {Open output file} Rewrite (ToF, 1); {Record Size = 1} Canvas.Textout (10, 10, 'Copying' INTOSTR (FileSize (fromf)) 'Bytes ...'); Repeat Blockread (fromf, buf, sizeof (buf), numread; blockwrite (TOF , BUF, Numread, NumWritten; Until (NumRead = 0) or (NumWritten <> Numread); Closefile (fromf); Closefile (TOF); end; end; end; ## blockready ----- -------------------------------------------------- ---------------------- BLOCKWRITE Write the memory block into the file. ----------------- -------------------------------------------------- --------- Unit System Function Prototype Procedure Blockread (var f: file; var buf; count: integer [; var result: integer); function prototype Procedure Blockwrite (var f: file; var buf; Count: Integer [; Var Result: INTEGER]); Example Var fromf, TOF: File; Numread, Numwritten: Integer; buf: array [1..2048] of char; becomf, officeialog1.filename; reset (fromf, 1); {record size = 1 } if SaveDialog1.Execute then {Display Save dialog box} begin AssignFile (ToF, SaveDialog1.FileName); {Open output file} Rewrite (ToF, 1); {Record size = 1} Canvas.TextOut (10, 10, 'Copying ' INTOSTR (FileSize (FROMF)) ' Bytes ... '); Repeat Blockread (fromf, buf, sizeof (buf), Numread; Blockwrite (TOF, BUF, NumRead, NumWritten); Until (NumRead = 0) OR (Numwritten <>

Numread; Closefile (fromf); Closefile (TOF); end; end; end; =============================== ======= Variant Support Routines ghost change variable letter ==================================== === VararrayCreate creates a variant array. ----------------------------------------------------------------------------------------------------------------------------------- ----------------------------------- Unit System System Function VararrayCreate (Const Bounds: Array Of Integer; VARTYPE: INTEGER: VARIANT; Sample Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); var A: variant; s: string; begin A: = varVRAYCREATE ([0, 4], varvariant; a [0]: = 1; A [1]: = 1234.5678; A [2]: = 'Hello World'; a [3]: = true; a [4]: ​​= varrayof ([1, 10, 100, 10000]); s: = a [4] [2]; s: = a [2] '' S; Label1.caption: = S; END; Description S: = a [4] [2]; Variant can do without a function to switch. Only Can be used alone, if it is incorrectly, it is incorrect. S: = a [2] '' a [4] [2];

VarTypevarEmpty $ 0000 The variant is Unassigned.varNull $ 0001 The variant is Null.varSmallint $ 0002 16-bit signed integer (type Smallint) .varInteger $ 0003 32-bit signed integer (type Integer) .varSingle $ 0004 Single-precision floating-point value (type Single ) .varDouble $ 0005 Double-precision floating-point value (type Double) .varCurrency $ 0006 Currency floating-point value (type Currency) .VarDate $ 0007 Date and time value (type TDateTime) .VarOleStr $ 0008 Reference to a dynamically allocated UNICODE string.varDispatch $ 0009 Reference to an OLE automation object (an IDispatch interface pointer) .VarError $ 000A Operating system error code.varBoolean $ 000B 16-bit boolean (type WordBool) .varVariant $ 000C Variant (used only with variant arrays) .varUnknown $ 000D Reference To an unknown ole Object (an iUnknown interface Pointer) .varbyte $ 0011 8-bit unsigned integer (Type Byte) .varstring $ 0100 Reference To a Dynamical-Allocated Long String (Type Ans iString) .varTypeMask $ 0FFF Bit mask for extracting type code. This constant is a mask that can be combined with the VType field using a bit-wise AND..varArray $ 2000 Bit indicating variant array. This constant is a mask that can be combined with the VType field using a bit-wise AND to determine if the variant contains a single value or an array of values.VarByRef $ 4000 This constant can be AND'd with Variant.VType to determine if the variant contains a pointer to the indicated data Instead of containing the data itself. Example VAR V1, V2, V3, V4, V5: Variant; I: Integer; D: Double; S: String; Begin V1: = 1; {Integer Value} V2: = 1234.5678;

{Real value} v3: = 'Hello World'; {string value} v4: = '1000'; {string value} v5: = V1 V2 V4; {real value 2235.5678} i: = v1; {i = 1 } D: = V2; {D = 1234.5678} S: = V3; {s = 'hello world'} i: = v4; {i = 1000} S: = V5; {s = '2235.5678'} end; - -------------------------------------------------- ------------------------- Vararrayof builds a simple one-dimensional Variant Array -------------------------------------------------------------------------------------- -------------------------------------------------- ----------- Unit System Function Prototype Function Vararrayof (Const Values): Variant; Sample Var A: Variant; Begin A: = Vararrayof ([1, 10, 'Hello, 10000] ); S: = a [1] '' INTOSTR (a [2]); label1.caption: = S; end; -------------------- -------------------------------------------------- ------- Vararrayredim Refies the high-dimensional part of the Variant array. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------- Unit system --- -------------------------------------------------- ------------------------ Function prototype Procedure VararrayRedim (VAR A: Variant; Highbound: integer); -------------------------------------- -------------------------------------- VararrayDimcount passed the dimension of the Variant array .-- -------------------------------------------------- ------------------------- Unit System Function Prototype Function Vararraydimcount (Const A: Variant): Integer; ---------- -------------------------------------------------- ----------------- VararrayHighBound returns a high note in the Variant array. --------------------- -------------------------------------------------- ----- Unit System Function prototype Function VararrayHighBound (const A: variant; dim: integer): Integer;

-------------------------------------------------- --------------------------- VararraylowBound passed the one-dimensional low note in the Variant array. ----------- -------------------------------------------------- --------------- Unit System Function prototype Function VararraylowBound (const A: variant; dim: integer): integer; example procedure tform1.button1click (sender: Tobject); var A: Variant : Count: integer; lowbound: integer; i: integer; s: string; begin a: = varivreate ([0, 5, 1, 3], varvariant); count: = varagedimcount (a); s: = # 13 'dimension:' INTOSTR (count) # 13; for i: = 1 to count do beg highbound: = vararrayhighbound (a, i); lowbound: = vararraylowbound (a, i); s: = S 'Highbound:' INTOSTR (HighBound) # 13; s: = S 'Lowbound:' INTOSTR (Lowbound) # 13; End; ShowMessage (s); end; ---------- -------------------------------------------------- ----------------- VararrayLock puts the Variant array ==> specified to a array variable. -------------------- -------------------------------------------------- -------- -VARARRAYUNLOCK releases the above specified. ------------------------------------------------------------------------------------------- --------------------------------- Unit System function prototype Function VaRraylock (var A: Variant): Pointer; function Prototype Procedure Vararrayunlock (var A: TFORM1.BUTTON1CLICK (Sender: TOBJECT); const highval = 12; type tdata = array [0..highval, 0..hiGHVAL] of integer; var A: Variant; i , J: Integer; data: ^ tdata; begin A: = varagecreate ([0, highval, 0, highval], varinteger; for i: = 0 to highval do for j: = 0 to Highval DO A [i, j ]: = i * j; data: = varArrayLock (a); for i: = 0 to HighVal do for j: =

0 to highval do grid1.cells [i 1, j 1]: = INTOSTR (data ^ [i, j]); varArrayunlock (a); end; -------------- -------------------------------------------------- ------------- VarisArray Pass whether it is an array. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ System function prototype function VarIsArray (const V: Variant):. Boolean; VarIsEmpty Variant returned if not registered (empty) Unit System function prototype function VarIsEmpty (const V: Variant): Boolean; example procedure TForm1.Button1Click (Sender: TObject ); Var A: variant; s: string; begin A: = varVarraycreate ([0, 5, 0, 7], varvariant); if varisempty (a) Then s: = 'true' else s: = 'false'; Label1.caption: = S; End; ----------------------------------------- ------------------------------------ ** s: = false, A is created. -------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ----------- Unit System Function Prototype Function Varisnull (Const V: Varia NT): Boolean; --------------------------------------------- ------------------------------- VaraStype Turn Variant to another type of Variant .------ -------------------------------------------------- --------------------- Varcast --------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ SYSTEM Function Prototype Function VaraStype (Const V: Variant; VARTYPE: Integer): Variant; Function Prototype Procedure Varcast (var at: variant; const source: variant; variant; const same

Description VARTYPE cannot be VARRRAY or Varbyref. ------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------- Vartype returns to Variant's style. ------- -------------------------------------------------- ------------------- Unit system function prototype Function VARTYPE (Const v: Variant): Integer; --------------- -------------------------------------------------- ------------ VARCLEAR Clear Variant, becoming a unassigned state. ------------------------------------------------------------- ---------------------------------------------- Unit System Function prototype procedure varclear (var variant); --------------------------------------- -------------------------------------- VARCOPY copys a variant. ------- -------------------------------------------------- ------------------- Unit System Function prototype Procedure Varopy (var at: variant; const source: variant); Description and Dest: = Source; effect. - -------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- --------- VartodateTime will be VAR IANT turns to datetime. ------------------------------------------------------------------------------------------- ------------------------------ Unit system function prototype Function VarfromDatetime (datetime: tdatetime): Variant; function prototype Function VartodateTime (const v: variant): tdatetime; =================================================================================================================================================================================== =================== Procedure TFORM1.Button2Click (Sender: Tobject); var Bitmap: Tbitmap; begin bitmap: = tbitmap.create; try bitmap.LoadFromFile ('g: /33.BMP '); Form1.canvas.brush.bitmap: = Bitmap;

Form1.canvas.FillRect (RECT (0, 0, 18, 15)); Finally Form1.canvas.brush.bitmap: = NIL; Bitmap.Free; end; end; ## canvas, brush, bitmap, fillRect Example == ===================================== xtout =================================================================================================================================================================================================================================== ================================================================================================ = 0 to 4 do begin HeaderSection: = HeaderControl1.Sections.Add; HeaderSection.Text: = 'Text Section' IntToStr (I); HeaderSection.MinWidth: = length (HeaderSection.Text) * Font.Size; // Owner draw every other section if (I mod 2 = 0) then HeaderSection.Style: = hsOwnerDraw else HeaderSection.Style: = hsText; end; end; procedure TForm1.HeaderControl1DrawSection (HeaderControl: THeaderControl; Section: THeaderSection; const Rect: TRect; Pressed: Boolean; begin with headercontrol.canvas do beg // highlight pressated sections if Pressed the font.color: = CLRED ELSE FONT.COLOR: = CLBLUE; Textout .Left font.size, rect.top 2, 'Owner Drawn text'); end; end; ## HeadersECTION, OnDrawSECTION, Sections, Canvas, TextOut Example -------------- ------------------------------------------ Trunc EXAMPLE ---- -------------------------------------------------- ----- Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); VAR S, T: STRING; Begin Str (1.4: 2: 1, t); s: =

T 'Truncs to' INTOSTR (Trunc (1.4)) # 13 # 10; STR (1.5: 2: 1, t); s: = S T 'Truncs to' INTOSTR (Trunc (1.5)) # 13 # 10; STR (-1.4: 2: 1, t); s: = S T 'Truncs to' INTOSTR (Trunc (-1.4)) # 13 # 10; STR (-1.5: 2 : 1, t); s: = S T 'Truncs to' INTOSTR (Trunc (-1.5)); Messagedlg (S, Mtinformation, [MboK], 0); END; unsteading ----- --------------- WrapText --------------------- sysutilstype tsyscharset = set of charvar s, r: string; begins: = '123456_123456_123456'; R: = WrapText (s, # 13 # 10, ['1', '4'], 4); Messagedlg (r, mtinformation, [mbok], 0); End; ===== =========================== widechartostrvar (Source: PWIDECHAR; VAR DEST: STRING); ----------- -------------- SYSTEM ---------------- ================== ======= widechartostring (Source: pWideCha): String; ------------------------- system ======== ===================== widecharlentostrvar (Source: PWIDECHAR; Sourcelen: Integer; var dest: ------------- ----------------- system ============= ================= widecharlentostring (Source: pwidechar; sourcelen: integer): String --------------------- --System =======

===================== AnsicompareFileName (const S1, s2: string): integer; sysutils ================ =================== rsiextractquotedstr (var s: pchar; quote: char): string; s2:/?; begin s1: = '/ ?? . ???????????????.56/ '; s2: = ANSIEXTRACTQUOTEDSTR (S1,' / '); // s2: =' ??. ????????? ? 'Messagedlg (S2, Mtinformation, [Mbok], 0); End; --------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------ AnsilowerCaseFileName (Const S: String : String; Sysutils ---------------------------------------------------------------------------------------------------------------------------------- ------------- ANSIPOS (Const Substr, s: String): Integersysutilsvar Substr, S: String; i: integer; begin s: = '???????? ??? ??? '; substr: =' ??? '; i: = ansipos (SUBSTR, S); // i: = 3 ... End; --------------- ------------------------------------------ ANSIQUOTEDSTR (Const s: String; Quote: char): String; sysutilsvar s: string; begin s: = '1997-1998 ??.'; S: = ANSIQUOTEDSTR (S, '-'); // s: = '-1997--1998 ?? .-' Messagedlg (s, mtinformation, [mbok], 0); end; ------- -------------------------------------------------- -AnsisameStr (Const S1, S2: String): Boolean; Sysutils -------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- ANSISAMETEXT (Const S1, S2: String): Boolean;

SYSUTILS ------------------------------------- --------- AnsistrComp (S1, S2: PCHAR): Integersys /LS ------------------------------------------------------------------------------------------- --------------------------- Ansistricomp (S1, S2: PCHAR): Integer; sysutils ----------- ---------------------------------------------- ANSISTRLASTCHAR (P : Pchar): Pchar; sysutils ----------------------------------------------------------------------------------------------------------------------------------- --------------- ANSISTRLCOMP (S1, S2: PCHAR; MAXLEN: Cardinal): Integer; sysutilsvar P1, P2: PCHAR; LEN: Integer; begin p1: = '???? ?? ?????????? ?? ?????? ???????????????????; p2: = '?????? ?????????? ?? ?????? ???????????????????; len: = Length (P1) -1; if Ansistrlicomp (P1, P2, LEN) = 0 Then Messagedlg (p1 # 13 p2 # 13 '??????? ????????? ??????' INTOSTR (LEN) '????????, ?????', mtinformation, [mbok], 0); end; ---------------------- ------------------------------------ Ansistrlicomp (S1, S2: PCHAR; MAXLEN: Cardinal): Integer Sysutilsvar p1, p2: pchar; len: integer; begin le: = 7; p1: = '?????? 1'; p2: = '?????? 2' IF ANSISTRLICOMP (P1, P2, LEN) = 0 Then Messagedlg (p1 # 13 p2 # 13 '??????? ??????????????' INTOSTR (LEN ) '????????, ?????', mtinformation, [mbok], 0); END; -------------------- -------------------------------------- ANSISTRLOWER (S1, S2: PCHAR): PCHAR; SYSUTILS -------------------------------------------------- -------- ANSISTRPOS (S, Substr: Pchar): PCharsysutilsvar S1, S2: Pchar; Begin S1: = '???? ???? -? ????? ????! '; S2: = ANSISTRPOS (S1,' ?????); // s2: = '????? ????!' Messagedlg (S2, Mtinformation, [MboK], 0);

-------------------------------------------------- -------- Ansistrrscan (s: pchar; chr: char): pchar; sysutilsvar P1, P2: PCHAR; Begin P1: = 'C: / Windows / Temp'; P2: = ANSISTRSCAN (P1, '/ '); {P2: =' / TEMP '} Messagedlg (p2, mtinformation, [mbok], 0); END; ----------------------- ---------------------------------- ANSISTRSCAN (S: Pchar; Chr: char): pchar; sysutilsvar P1 P2: PCHAR; Begin P1: = 'http://www.atrussk.ru/delphi'; p2: = ANSISTRSCAN (P1, '/'); {p2: = '//www.atrussk.ru/delphi' } Messagedlg (P2, Mtinformation, [Mbok], 0); end; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------ Ansistruppper (s: pchar): Pcharsys /LS -------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: SYSUTILS ------------------------------------- --------- Bytetocharindex (Const S: String; Index: Integer): Integer; sysutils ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------- ByTTocharlen (const s: string; maxlen: integer): i Nteger; sysutils -------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- ByType (Const S: String; Index: Integer): TMBCSBYTYPE; SYSUTILSMBSINGLEBYTE - MBLEADBYTE - MBTRAILBYTE - ------------------- --------------------------------------- Chartobyteindex (Const S: String; Index: Integer) : Integer; sysutils ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------ CHARTOBYTELEN (Const S: String; Maxlen: Integer): Integer; sysutils ----------------------- ---------------------------------- CHR (X: Byte): char; sysutilsmessagedlg ('ASCII-? ??? 77 ??????????????????? - ' chr (77), mtinformation, [mbok], 0);

-------------------------------------------------- ------- Formatmasktext (const Editmask: string; const value: string): string; mask -------------------------------------------------------------------------------------------------------- -------------------------------- GetformatSettings; sysutils --------------- ------------------------------------------ Isdelimiter (Const Delimiters, s: String; index: integer: boolean; sysutilsvar s: string; begin s: = '??????? ??????????!; if isdelimiter (' !, - ', s, 8) THEN MESSAGEDLG (' ???????! ', Mtwarning, [mbok], 0) else messagedlg (' ??????????! ', Mtwarning , [Mbok], 0); End; -------------------------------------------------------------------------------------------------------------------------------- ----------------- ISPATHDELIMITER (Const S: String; Index: Integer): Boolean; SYSUTILSIF IsPathDelimiter (s, length (s)) THEN S: = Copy (s, 1, Length (s) -1); ------------------------------------------------------------------------------------- ------------------ LastDelimiter (Const Delimiters, S: String): Integer; sysutilsvar i: integer; begin i: = LastDelimiter ('!;;, -', ' ???????, ??????, ???????????); // i: = 16nd; --------------- ------------ ----------------------------------- Linestart (Buffer, BUFPOS: PCHAR): PCHARCLASES ----- -------------------------------------------------- --- QuoteDSTR (const S: string): string; sysutils ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- SEGTH (VAR S; Length: integer); system ----------------- ----------------------------------------- setString (var s: string; buffer: PCHAR; Length: integer; system ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------- Str (x [: width [: decimals]]; var s); systemvars: string; i: real; begini: = -52.123456789; str (i: 6: 2, s); {s: = '-52.12'} messagedlg (s, mtinformation, [mbok], 0);

-------------------------------------------------- -------- Strbufsize (s: pchar): cardinal; sysutils -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------- Strbytetype (s: pchar; index: cardinal: TMBCSBYTYPE; SYSUTILS ------------------------------------------------------------------------ ------------------------------------------------ StringOfchar ( CH: char; count: integer: string; systems: = stringofchar ('.', 3); // s: = '... ------------------- ---------------------------------------- StringReplace (Const S, Oldsubstr, NewsUbstr: string; Flags: TReplaceFlags): string; SysUtilstype TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase); varS: string; Flags: TReplaceFlags; beginFlags: = [rfReplaceAll, rfIgnoreCase]; S: = '???? - ???? ? ????? '; s: = stringreplace (s,' ?? ',' ?? ', flags); // s: =' ???? - ????? ????? } Messagedlg (S, Mtinformation, [Mbok], 0); End; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------ StringTowideChar (Const Source: String; DEST: PWIDECHAR; DESTSIZE: INTEGER): PWIDECHARSYSTEM --------- ------------------------------- ----------------- UniqueString (var s: string); system ----------------------- ----------------------------------- =============== =============== message ==============================

-------------------------------------------------- ------------- ShowMessage Message ----------------------------------- ---------------------------- Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); Var Buffer: array [0..255] of char ; FileToFind: string; begin GetWindowsDirectory (buffer, SizeOf (buffer)); FileToFind: = FileSearch (Edit1.Text, GetCurrentDir ';' buffer); if FileToFind = 'then ShowMessage (' Could not find ' Edit1. TEXT '.') Else ShowMessage ('Found' FileTofind '); End; ## filesearch, showMessage Example ------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------ Findcomponent Examples (1) Type Logpal = Record LPAL: TLOGPALETTE; DUMMY : Array [0..255] of TPaletteEntry; end; procedure TForm1.SaveAsBmpClick (Sender: TObject); var Source: TComponent; SysPal: LogPal; tempCanvas: TCanvas; sourceRect, destRect: TRect; image2save: TImage; notUsed: HWND; Begin Source: = Findcomponent (Edit1.Text); IF (Not Source Is Tcontrol) OR ((NOT SOURCE) Is Twincontrol) and (Source As Tcontrol) .parent = nil)) The begin beep; showMessage (edit1.text 'is not a valid control.'); exit; end; tempcanvas: = tcanvas.create; try with source as TControl do tempCanvas.Handle: = GetDeviceContext (notUsed); image2save: = TImage.create (self); try with image2save do begin Height: = (Source as TControl) .Height; Width: = (Source as TControl) .Width; DESTRECT: = Rect (0, 0, Width, Height); if Source is TwinControl Then SourceRect: = DESTRECT; Else SourceRect: =

(Source as TControl) .BoundsRect; Canvas.CopyRect (destRect, tempCanvas, sourceRect); SysPal.lPal.palVersion: = $ 300; SysPal.lPal.palNumEntries: = 256; GetSystemPaletteEntries (tempCanvas.Handle, 0,256, SysPal.lpal.PalpalEntry ); Picture.Bitmap.Palette: = CreatePalette (Syspal.lpal); end; if SaveDialog1.Execute then image2save.Picture.SaveToFile (SaveDialog1.FileName); finally image2save.Free; end; finally tempCanvas.Free; end; end; Example (2) Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); var i: integer; const nameprefix = 'myEdit'; begin for i: = 1 to 20 do begin tedit.create (self) .Name: = NamePrefix INTSTR I); with TEDIT (FindComponent (NamePrefix INTSTR (I)))) DO Begin Left: = 10; TOP: = I * 20; Parent: = Self; End; end; end; ========= ========================================================= Procedure TFORM1 .Button1Click (Sender: TOBJECT); VAR A: Variant; Begin A: = VaRrayCreate ([0, 4], Varvariant); A [0]: = 1; A [1 ]: = 1234.5678; A [2]: = 'Hello World'; a [3]: = true; a [4]: ​​= varrayof ([1, 10, 100, 1000]); edit1.text: = (a [2]); {Hello World} Edit2.Text: = (a [4] [2]); {100} end; procedure tform1.button2click (sender: Tobject); var s: string; begin s: = 'honest Abe Lincoln '; delete (s, 8, 4); canvas.textout (10, 130, s); {' honest lincoln '} end; procedure tform1.button3click (sender: TOBJECT); var s: string;

Begin s: = 'Abcdef'; s: = COPY (S, 2, 3); edit1.text: = s; {'bcd'} end; procedure tform1.button4click (sender: TOBJECT); var s: string; begin S: = Concat ('ABC', 'DEF'); Edit1.Text: = S; {'Abcde'} end; procedure tform1.button5click (sender: Tobject); var s: string; begin s: = 'honest lincoln '; INSERT (' Abe ', S, 8); edit1.text: = S; {' honest Abe lincoln '} end; procedure tform1.button6click (sender: TOBJECT); var s: string; begin s: =' THE Black knight '; canvas.textout (10, 130,' string length = ' INTTOSTR (Length (s))); {string length = 16} Edit1.Text: = S; {THE black knight} end; procedure tform1. Button7Click (Sender: TOBJECT); var s: string; begin s: = '123.5'; {Convert Spaces to Zeroes} While Pos ('', s)> 0 do s [POS (', s)]: =' 0 '; edit1.text: = s; {000123.5} end; =================================== =================================================================================================================================================================== ============================================================================================================================================================================================================= == ============

========== ABS is the absolute value of the number of. Function ABS (X); Arctan is transmitted back to the reverse function value of the normal cut function. Function Arctan (x: Real): Real; CoS Biography Function Function COS (X: REAL): REAL; (x in an arc). EXP is sent back to the natural index value. Function COS (X: REAL): REAL; FRAC is transmitted back to the decimal part of the number. Integer Site of the INT Reed. Function INT (X: REAL): REAL; LN Removes Natural Alignment. Function LN (X: REAL): REAL; PI Removes the value of the circular rate π. Function PI: REAL; SIN is transmitted back the string function value. Function SIN (X: REAL): REAL; SQR is sent back to the number of. Function SQR (X: REAL): (REAL); SQRT back the square root of the number.

Function SQRT (X: REAL): REAL; ======================================== =================================== console routines ======== ============================================================================================================================================================================================================= ================= Unit: WinCRT function name function description function syntax ========================= ============================================================================================================================================================================================================= = AssignCRT links the text file to a console window. Procedure AssignCRT (var f: text); Clreol Cleout Cursor position to all the characters of the line. PROCEDURE CLREOL; CLRSCR Clean the screen and reset the cursor to the upper left corner. Procedure CLRSCR; CURSORTO mobile cursor to a given seat. Procedure CursorTo (X, Y: Integer); DonewinCRT ends the console window. Procedure donewincrt; gotoxy mobile cursor to a given seat. Procedure gotoxy (x, y: byte); INITWINCRT establishes a console window. Procedure initwincrt; keypressed determines if there is a button. Function Keypressed: Boolean; Readbuf is read from the console site.

Function Readbuf (Buffer: Pchar; Count: Word): ReadKey Reads button. Function Readkey: Char; Scrollto Rolling Control Table and Windows to Display Location. Procedure ScrollTo (X, Y: Integer); TrackCursor rolling control desktop window is visible to the cursor. Procedure TrackCursor; Wherex Retrieves the X coordinate of the target. Function wherex: Byte; Wherey passed back the y mark of the target. Function where: Byte; WriteBuf is written to a block of blocks to the console window. Procedure WriteBufwriteChar writes a character to the console window. Procedure writechar (ch: char); ============================================= ======= Date and time function (Date and time routines) unit: systemils ============================== ========== Date Remove today. Function date: TDATETIME; DateTimetostr Transfers the time format into a string. Function dateTimetostr (datetime: tdatetime): String; DateTimetostring converts the time format into a string. Procedure DateTimetostring (Var Result: string; "DateTime: tdatetime); DateTostr transfers the date format into a string. Function datetostr (date: tdatetime): String; dayofweek is coming back today. Function Dayofweek (date: tdatetime): Integer; Decode Decomposition The date specified by the year, month, day. Procedure decodedate (Date: Tdatetime; var Year, Month, day: word); DecodeTime Decomposition The date specified is time, minute, second. Procedure Decodetime (Time: Tdatetime; Var Hour, min, sec, msec: word); Encodedate is transmitted back to the date format combined with the year, month, and Japan. Function EncodeDate (Year, Month, Day: Word): TDATETIME; ENCODetime is sent back to time, divided, minute, secondary time format. Function EncoDetime (Hour, min, sec, msec: word): tdatetime; formatDatetime backs the dateTree in the specified format. Function formatdatetime (const format: string; datetime: tdatetime): String; Now Retrieves the current date time. Function now: TDATETIME; Strtodate converts the strings into a date format.

Function start: tdatetime; StrtodateTime converts strings to date time format Function StrtodateTime (const String): TDATTIME; Strtotime converts strings to time format. Function Strtotime (const s: string): tdatetime; Time is backup current time. Function Time: TDATETIME; Timetostr will turn the time to string. Function Timetostr (Time: tdatetime): String; ========================================= Dynamic Allocation Routines Unit: System ======================================== = Dispose releases back a dynamic variable. Procedure Dispose (VAR P: ​​POINTER); Free releases an object copy. Procedure Free; FreeMem Releases a dynamic variable of a given size. Procedure FreeMem (size: word); getMem creates a dynamic variable specified by a specified size and is transmitted by the Pointer. Procedure getmem (var P: Pointer; SIZE: WORD); New builds a new dynamic variable and pointing the Pointer parameter to it. Procedure New (VAR P: ​​POINTER); Function New (): Pointer; MaxAvail passes back consecutive maximum configurable space. Function maxavail: longint; Memavail is sent back to all configurable spaces. Function Memavail: longint; ================================================= File management function unit: Sysutils =================================================================================================================================================00 Function ChangeFileExt (const filename, extension: string): String; DateTimetOfileDate converts Delphi's date format to DOS date format.

FunctionDateTimetOfileDate (datetime: tdatetime): longint; deletefile Deletes a file. Function deletefile (const filename: String): boolean; diskfree Retroile the available space of the disk. Function DiskFree: longint; disksize passed back to the size of the specified disk. Function Disksize: longint; ExpandFileName passed back a complete path and file name string. Function ExpandFileName (const filename: string): string; ExtractFileExt Removes the extended file of the file. Function ExtractFileExt (const filename string): String; ExtractFileName Retrieves the file name. Function ExtractFileName (const filename: string): string; ExtractFilePath passed back to the file. Function ExtractFilePath (const filename: string): String; Fileage Replies the files of the file FUNCTION Fileage (const filename: String): longint; filecreate establishes a file with the specified file name. Function FileCreate (const filename: string): Integer; FileClose Close the specified file. ProcedureFileClose (Handle: Integer); FileDateTodateTime converts DOS's date format to Delphi's date format. Function FileDateTodateTime (FileDate: longint): tdatetime; FileExists discriminates if the file exists. Function FileExists (const filename: string): boolean; FileGetAtTR Remove file properties. Function Filegetttr (const filename: string): Integer; FilegetDate Retrieves the date and time of the file. Function Filegetdate (Handle: Integer): longInt; FileRead reads information from the specified file. Function FileRead (Handle: Integer; Count: longint): longint; filesearch searches for specified files in the directory column. Function FileSearch (constname, dirlist: string): String; Fileseek changes the location of the archive cursor. Function Fileseek (Handle: Integer; ORIGIN: Integer: longint; filesetattr Sets the file properties. Function FileSetattr (Const filename: string; attr: integer): Integer; FileSetDate Sets the date and time of the file. Procedure FileSetDate (Handle: Integer; Age: longint); FileOpen enables the file. Function Fileopen (const filename: string; mode: word): Integer; FileWrite write information to the file. Function FileWrite (Handle: Integer; Count: longint): longint; FindClose terminates the first / next action.

Procedure FindClose (VAR Searchrec: Tsearch "; Findfirst Looking for the first fitted file and set its properties. Function Findfirst (const path: string; attr: word; var f: tsearchrec): integer; FindNext Removes the next compliant file. Function FindNext (VAR F: TSEARCHREC): Integer; renamefile change the file name. Function renamefile (const6ame: String): boolean; ==================================== === floating-point conversion function (floating-point conversion routines) Unit: systemils ================================== ======= Floattodecimal divides the floating point numerical (digital transmission of the decimal and integer part. Procedure floattodecimal (Value: Extended; Precision, DeciMals: Integer); floattostrf converts floating point numbers into a string description in accordance with the specified format. Function floattostrf (value: tfloatformat; precision, digits: integer): String; floattostr Transfers floating point number into a string description. Function floattostr (value: extended): string; floattotext will pass the floating point value, divided into decimal and integer partial part in accordance with the format. Function floattotext (buffer: pchar; value: extended; format: tfloatformat; precision, digits: integer: integer; floattotextFMT Transfer floating point number into a string back in accordance with the format. Function floattotextfmt (buffer: pchar; value: integer; formatfloat) Refers to the Format format in accordance with the format format. Function formatfloat (constformat: string; value: extended): String; StrtOFLOAT converts the string to a floating point value.

Function StrtOFLOAT (const S: String): EXTENDED; TextTOFLOAT converts a NULL end string into floating point numerical Function TEXTTTOFLOAT (BUFFER: PCHAR; VAR value: Extended): boolean; ============ ============================ Flow-control routines unit: system =========== ===================================== Break terminates the ring. Returning in For, While and Repeat. Procedure Break; Continue continues to return the ring. Returning in For, While and Repeat. Procedure Continue; EXIT leaves the current block. Procedure exit; Halt stop program execution and return to the job system. Procedure Halt [(EXITCODE: WORD)]; RUNERROR stop program execution. Procedure RuNerror [(ErrorCode: Byte)]; ======================================== Output function (I / O Routines) unit: system ======================================= == AssignFile Specifies a file to file variable. Procedure assignfile (var f, string); Closefile Close the file. Procedure Closefile (var f); EOF determines if it has arrived at the end of the file. TYPED or UNYPED Files: FunctionEOF (VAR f): Booleantext Files: Function EOF [(VAR f: text)]: boolean; ERASE clears file content. Procedure Erase (VAR F); FilePOS is passed back to the current file cursor position. Function FilePos (VAR f): longint; FileSize Replies Size Function FileSize (var f): longint; getDir passed back to the working directory of the specified disk. Procedure getDir (d: byte; var s: string); iResult is transmitted back to the status of the last I / O execution. Function iiResult: integer; MKDIR creates a subdirectory.

Procedure mkdir (s: string); rename Changes the file name of the external archive. Procedure rename (var f; newname); RESET turns on an existing file. Procedure Reset (VAR F [: File; RecSize: Word]); REWRITE is established and turned on. Procedure Rewrite (var f: file [; recsize: word]); RMDIR deletes an empty directory. Procedure RMDir (S: String); SEEK mobile archive cursor. Procedure Seek (VAR F; N: longint); Truncate deletes file content after the current location. Procedure truncate (var f); ========================================= Memory management Function Memory-Management Routines) Unit: systemils ================================================ Allocmem Configure a memory block to accumulate HEAP. Function Allocmem (Size: cardinal): Pointer; ReallocMem Removes a block from the accumulation. Function Reallocmem (p: Pointer; CURSIZE, NEWSIZE: cardinal): Pointer; ==================================== ====== Miscellaneous Routines Unit: system, sysutils ================================= ======= AddExitProc Add a program to the executive period library. Procedure addExitProc (Proc: tprocedure); Exclude removes an element from a collection. Procedure Exclude (Var S: set of t; i: t); FillCha fills in a variable number to a variable in one by a character. Procedure Fillchar (VAR X; Count: Word; Value); HI's high tuple of the number of. Function Hi (x): byte; include the element into the collection. Procedure Include (Var S: set of t; i: t); LO transmission back to the low talent group.

Function lo (x): byte; Move Copy the number of points in the count of counts from the Source. Procedure Move (Varsource, Dest; Count: Word); paramcount passed the number of commands. Function paramcount: Word; Paramstr is sent back to a specified command column number. Function paramstr (index): string; Random is returned to a random mess. Function Random [(RANGE: WORD)]; Randomize initialized chaos generator. Procedure randomize; SIZEOF is transmitted back to the number of components of the number. Function SizeOf (X): Word; SWAP exchanges the high tuning and low tuning of the number. Function swap (x); TypeOf autism comes back to the indicator of the virtual method table of the object type. Function TypeOf (x): PointerupCase converts the character to uppercase. Function Upcase (CH: Char): char; ========================================= Ordinal routines unit: system ======================================== DEC Decrease a variable. Procedure dec (VAR x [; N: longint]); incaps a variable procedure inchaptive; VAR X [N: longint]); ODD discrimination is odd. Function ODD (x: longint): Boolean; PRED pass back the predecessor of the number. Function PRED (X); SUCC's successor. Function succ (x); ========================================= Indicator and address Pointer and address routines unit: system ========================================== Addr is transmitted back to the address of the specified object. Function addr (x): Pointer; Assigned determines whether a function or program is NIL Function Assigned (VAR P): Boolean; CSEG is transmitted back to the CS segment segment specification. Function CSEG: Word; DSEG Removes the content of the DS data segment specification. Function DSEGT: Word; OFS Transmission back the offset site.

Function OFS (X): Word; PTR combines the specified segment and offset bit to an indicator. Function PTR (SEG, OFS: WORD): Pointer; SEG is sent back to the segment address of the number. Function seg (x): Word; SPTR is transmitted back to the SP stacker. Function SPTR: Word; SSEG Removes the contents of the SS stack segment scaler. Function SSEG: WORD; ==========================================================================★ String-formatting routines) Unit: sysutils ================================================== The numbers listed in accordance with the format of Format to the Result string back. Procedure FMTSTR (var resut: string; const args: array of const); Format combines the column number in accordance with Format's format to the Pascal format string back. FONCTION FORMAT (const format: string; const args: array: const): string; formatbuf formatted the number of queues listed. FormatBuf (var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of string): Cardinal; function FormatBuf (var Buffer; BufLen: Word; const Format; FmtLen: Word; Const Args: array of const) : Word; Strfmt formats the number of 叁 listed. Function strfmt (buffer, format: pchar; const args: array of const): PCHAR; SYSUTILSSTRLFMT formats the number of 叁, and points the result to the buffer metrics.

Function strlfmt (buffer: pchar; mxlen: Word; Format: pchar; const args: array of const): pchar; sysutils ================================= ================ String-handling routines: pascal-style) unit: systutils ================= ======================================= Ansicomparestr compares two strings. Function AnsiiMPareStr (Const S1, S2: String): Integer; sysutilsvar s: string; mas: array [0..99] of string; i, j: integer; begin ... for i: = 1 to 98 do for j : = i 1 to 99 DO if AnsicompareStr (MA [i], MAS [J])> 0 THEN BEGIN S: = MAS [I]; MAS [I]: = MAS [J]; MAS [J]: = S; end; end; vars1, s2: string; i: integer; begins1: = '? ???? ????????? ??????; S2: ='????? ?????????????? '; i: = compareStr (S1, S2); {i> 0,?.?. S1> S2} IF i <> 0 Then Messagedlg (' ?? ???? ?????????! ', MTWARNING, [Mbok], 0); End; AnsicompareText compares two strings and no casement. AnsicompareText (const S1, s2: string): Integer; sysutilsiicomparestr ('a', 'a') <0compareStr ('a', 'a')> 0Function AnsiCompareText (Const S1, S2: String): Integer; AnsilowerCase The string content is converted to lowercase. Function AnsilowerCase (const S: String): String; s: = 'myfile.txt'; s: = AnsilowerCase (s); // s: = 'myfile.txt' Messagedlg (s, mtinformation, [Mbok], 0); END; ANSIUPPERCASE converts the string content to uppercase.

Function ANSIUPPERCASE (Const S: String): String; s: = 'c: / windows'} messagedlg (s: {s: = 'c: / windows'} messagedlg (s, Mtinformation, [Mbok], 0); End; appendsTr connects the string to the DEST string. Procedure appendstr (var dest: string; const s: string); AssignStr Configuring a memory space to give a string. Procedure appendstr (var P: pstring; const s: string); CompareStr compares two strings. Function CompareStr (Const S1, S2: String): Integer; CompareText compares two strings and no casement. Function CompareText (Const S1, S2: String): Integer; Concat links the column string. Function Concat (S1 [S2, ..., Sn]: string: String; Copy Transfer Site String Part of the String. Function Copy (S: String; Index, Count: Integer): String; delete deletes the subtronom in the given string. Procedure delete (virt s: string; index, count: integer); DisposeStr Releases the space occupied by the string. Procedure DisposeStr (P: pstring); FMTLOADSTR is loaded into a string in the program of resource string table. FmtLoadStr (Ident: Integer; const Args: array of string): string; SysUtilsfunction FmtLoadStr (Ident: Word; const Args: array of const): string; Insert inserting a substring procedure Insert (Source within a string: String , VAR S: String; INDEX: INTEGER; INSERT (Source: String; var s: string; index: integer; systemvar s: string; begin s: = '??????? ?????? ??????????. '; Insert ('! ', S, 8); {s: =' ???????! ?????? ??????? ???. '} Messagedlg (S, MTWARNING, [Mbok], 0); end; INTTOHEX will turn an integer to a hexadecion. Function INTTOHEX (Value: ": integer: string; INTSTR converts the digital to the word format. Function INTOSTR (Value: longint): string; isvalidIdent discriminates whether the string content is the correct identification word. Function isvalidIdent (const Ident: string): boolean; longens pass back the length of the string. Function Length: Integer; loadStr From the application's executable file into a string resource. Function LoadStr (Ident: Word): String; SysutilSlowercase converts the string to lowercase. Function LowerCase (const s: string): String; NewStr From the accumulation of a string space.

Function newsTr (const s: string): pstring; POS transmission back the position in the string. Function POS (SUBSTR: STRING; S: String): STR turns a value into a string. Procedure Str (x [: width [: decimals]; var s); StrtOINT converts the string into an integer value. Function start (const s: string): longint; startdef will turn the string to a value or a preset value. Function startdef (Const: string; default: long): longint; Uppercase converts strings to uppercase. Function Uppercase: string; sysutilsvar s: string; begin s: = Uppercase ('???????? intel'); {s: = '???????? intel' } END; VAL converts the string content to a numerical description. Procedure Val (S; Var var code: integer); system {$ R } {$ r-} var i, code: integer; beginval (edit1.text, i, code); {??????? ????????? ????? ?????????????? edit1.text? ???????? ?????} if code <> 0 {????????? ?????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????? ???????: ' INTOSTR (CODE), MTWARNING, [MBOK], 0) Else {??????? ??????? ???? ?} Canvas.textout (20, 20, INTSTR (SQR (I))); end; ============================== =========== String-handling routines: null-tERMINATED) Unit: systemils ============================================================================================================================ ==================stralloc Configure a buffer for a maximum length of Size-1 to null end string Function Stralloc (size: word): pchar; strbufsize The maximum number of characters can be stored in the configured string buffer. Strbufsize (s: pchar): cardinal; sysutilsfunction strbufsize (str: pchar): WRD; STRCAT links two strings and pass back the string. Function Strcat (DEST, SOURCE: PCAR): PCHAR; Strcomp is compared to two strings.

Function strcomp (str1, str2: pchar): integer; strcopy copy Source string to DEST. Function Strcopy (DEST, SOURCE: PCHAR): Pcharstrdispose Releases a string space. Function strdispose (str: pchar); strcopy copies the Source string to the DEST and passed back to the indicator of the end of the string. Function strecopy (DEST, SURCE: PCHAR): PCHAR; STREND Replies a indicator pointing the end of the string Function Strend (strlcat): pchar; strlcat After connecting the Source string to the DEST string and pass back the word string. Function strlcat (DEST, SOURCE: PCAR; MAXLEN: WORD): PCHAR; STRICOMP Compare two word cascading differences Function Stricomp (str1, str2: pchar): integer; strlcomp compare two strings to the most specified maximum Function strlcomp (Str1, str2: pchar; max: word): integer; strlcopy Copying the specified word to another in another string Function strlcopy (DEST, Source: Pchar; Strlen): Pchar; Strlen: Pchaxlen: cardinal: pchar; strlen The length of the back string. Function strlen (str: pchar): cardinal; strlicomp compares two strings to the specified maximum length. No size. Function strlicomp (str1, str2: pchar; maxlen: word): integer; strlower converts strings to lowercase. Function strlower (str: pchar): pchar; strmove Copy the count of the count, from the Source to the DEST string. Function strmove (DEST, SOURCE: PCHAR; Count: cardinal): PCharstrNew is configured a string from the accumulation. Function strnew (str: pchar; strpas) Turn the NULL end word into a PASCAL format string. Function strpas (str: pchar): string; strpcopy Copy a Pascal format string to a NULL end string. Function strpcopy (DEST: PCHAR; Source: String): PCHAR; STRPLCOPY Copy Maxlen's fingering element, string from the PASCAL format to NULL end strings. Function strplcopy (DEST: PCHAR; COST SOURCE: STRING; MAXLEN: WORD): PCHAR; STRPOS Biography The position of the Str2 string is the first to appear in STR1. Function Strpos (str1, str2: pchar): PCHAR; STRSCAN back a indicator pointing to the first position of the CHR-element in the STR string. Function strscan (str: pchar; chr: char): PCHAR; STRSCAN Replies a indicator pointing to the location of the CHR-element in the final appearance in the STR substring. Function STRSCAN (STR: PCHAR; Chr: char): pchar; strupper converts the string to uppercase.

Function Strupper (str: pchar): pchar; ========================================= Text-file routines unit: system ========================================= == Append opens an existing archive to increase. Procedure append (var f: text); EOLN discriminates if a document is at the end. Function Eoln [(VAR F: Text)]: Boolean; Flush Clears the buffer of the text output file. Procedure flush (var f: text); Read from the file to the list of variables. Typed Files: Procedure Read (F, V1 [, V2, ..., VN]); Text Files: Procedure Read ([VAR F: text;] V1 [, V2, ..., VN]); readln reads information from files to The variables listed and jumped to the next line. Procedure Readln ([VAR f: text;] v1 [, v2, ..., vn]); seekeof discriminates whether it has arrived at the end. Function seekeof [(var f: text)]: boolean; seekeoln discriminates if a file is at the end. Function seekeoln [(VAR f: text)]: boolean; setTextBuf Specifies an I / O buffer to a text file. Procedure setTextBuf (var buf [; size: word]); WRITE writes information within variables to the file. TEXT Files: Procedure Write ([VAR F: Text;] P1 [, P2, ..., PN]); Typed Files: Procedure Write (f, v1 [v2, ... vn]); Writeln Execute the Write program and output a jump line Go to the file. Procedure Writeln ([var f: text;] p1 [, p2, ..., pn]); ============================== =========== Transfer routines unit: system ============================== ========== CHR Remove the character corresponding to the ASCII code.

Function chr (x: byte): char; Delphi source task (http://home.kimo.com.tw/bruce0211/) typing the highest value within the range of 15High. Function high (x); Low transmission back to the minimum number in the range. Function Low (x); ORD is transmitted back to a sequential value corresponding to the order. Function ORD (X): Longint; Round returns a real value to the integer value. Function Round (x: real): longint; Trunc Removes a real value to the integer value. Function trunc (x: real): longint; ======================================== Uned-file routines united file function (united "unit: system ==================================== ==== BlockRead reads one or several records to the BUF variable from the file. Procedure Blockread (var f: file; var buf; count: word [; var result: word]); BlockWrite writes one or several records from a variable.

Procedure BlockWrite (var buf; count: word [; var result: word]); =========================== ============================= WinAPI control and message function ---------------- AdjustWindowRect AdjustWindowRectex Given a window styling, calculating the size of the window required to obtain the rectangle of the target customer area =============================================================================================================================================================================== ======================== VB declaration Declare Function AdjustWindower LIB "User32" Alias ​​"AdjustWindower" (LPRECT AS RECT, BYVAL DWSTYLE AS Long, Byval Bmenu As Long) As LongDeclare Function AdjustWindowRectEx Lib "user32" Alias ​​"AdjustWindowRectEx" (lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long) As Long description given one kind of window style imports premise calculated Net returns a value of the window of the rectangle required for the target client area, if the execution is successful, return a non-zero value; if it fails, the zero value is returned. The GetLasTerror parameter type and the description of the LPRECT RECT, which initially contains the requested client area. The function is set to the target window. The rectangular size DWStyle Long, the window styles BMENU long, if the window has a menu, set to True (non-zero) DWESSTYLE LONG, extended window stylus (only available to AdjustWindowerRectex) annotation in call this function Before, get a form of a form with getWindowlong. If the menu occupies a space above two rows, the function cannot correctly calculate the size.

If the program uses multi-line headings, you should use getSystemMetrics =========================================== ========================================---------------------------------------- ------------------ VB Declaration Declare Function AnyPopup lib "user32" alias "Anypopup" () AS Long Description Decision The display is available for any pop-up window Return value long, If there is a pop-up menu, return TRUE (non-zero) annotation for this function, the pop-up menu contains all visible tolerance top-level windows, no matter whether the pop-up or overlapping window ========== ============================================================ arrangeiconicWindows is the smallest Chemical Window VB Declaration Declare Function ArrangeiconicWindows LIB "User32" Alias ​​"ArrangeConicWindows" (BYVAL HWND AS long) (BYVAL HWND AS long) (BYVAL HWND AS long) (BYVAL HWND As Long) The minimum sesson window is arranged (used in VB: Used to arrange icons at desktop, Get a handle of a desktop window with a getDesktopWindow function to return a value of a value of LONG, a height of the icon row; if it fails, zero is returned.

The GetLasTerror parameter table is set and the HWnd long, the handle of the parent window can also use the function to contain the custom control of the icon chemical sub-window ============ ==================================================== attachthreadInput connection thread input function BegindeferWindowPos boot Build a series of new window stunning positions BringWindowtotop to bring the specified window to the top of the window, the top of the window. Cascadewindows Return the window. CHildWindowFromPoint Return to the parent window. The first child window contains the first child window of the specified point. CLIENTTOSCREEN Judgment window囗 In the Customer District Coordinate CLOSEWINDOW minimizes the specified window CopyRect Rectangular content Copy the DeferWindowPOS This function specifies a new window 囗 position DestroyWindow Clear the specified window and all of its sub-windows imports DrawAnimatedRects depicts a series of rectangular windows EnableWindow imports specified in dynamic enable or disable all mouse and keyboard input EndDeferWindowPos update any position and status window DeferWindowPos imports of specified when calling EnumChildWindows as specified parent window imports enumerate child windows EnumThreadWindows gold imports All the parent windows in the list of the window 囗 ENUMWINDOWS enumeration window in the specified task are EqualRect to determine if the two rectangular structures are the same for the same FINDWINDOW Looking for the first top-level windows that meet the specified criteria FindWindowEx in the window. Looking for the first sub-window that matches the specified condition ====================================== FlashWindow flashes to display the designated window 囗 --- -------------------------- Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); Begin Form2.Show; Form1.Bringtofront; Timer1.Iterval: = GetCareTBlinkTime; Timer1.enabled: = not timer1.enabled; end; procedure tfor M1.Timer1Timer (sender: TOBJECT); Begin FlashWindow (Form2.Handle, True); End; ============================= = GetActiveWindow gets the handle of the active window GetCapture gets a window handle, which is located in the current input thread, and has a copy of the mouse capture (the mouse activity is received by it) GetClassInfo a copy of the WNDCLASS structure (or WNDCLASSEX structure).

The structure contains a LONG variable entry obtained with the specified class GetClasslong getting the window. GetClassName acquires class getClassword to the designated window. GetClassWord gets an integer variable getClientRect Returns the specified window. Customer zone rectangle GetDesktopWindow Represents a window of the entire screen (Desktop Window) handle getFocus gets the handle GetForegroundWindow with the input focus, get the handle of the front desktop GetLastactivePopup get the most recently activated pop-ups in a given father window. GetLastError gets the extended error message with this function to obtain the extended error message getparent to determine the parent window of the specified window. GetTopWindow searches for the internal window, and find the handle of the first window of the specified window to get a rectangle, it The portion that needs to be updated in the specified window ====================================== =========== getwindow gets a handle of a window, the window has a specific relationship with a source window ----------------- ----------------------------- procedure tform1.timer1timer (sender: TOBJECT); var s: array [0..29999] of CHAR; H: INTEGER; Begin H: = getWindow (Handle, GW_OWNER); // getWindow Take a window 囗 handle, which has a specific relationship with a source window GetWindowText (h, s, 300); // GetWindowText takes a form header (CAPTION) text, or control content edit1.text: = INTOSTR (h); label1.caption: = s; end; ================= =============================== GetWindowContexthelpid gets the help scene ID getWindowlong from the window 囗 to getWindowlong from the specified window Get information getWindowPlacement get the status and location information of the specified window, getWindowRec T Get the range of the entire window, the border of the window, the title bar, the scroll bar, the menu, etc. are all in this rectangle ======================== =========================

= GetWindowText gets a form of a form, or a control content ------------------------ Procedure TFORM1.TIMER1TIMER (Sender) : TOBJECT); VAR S: Array [0..29999] of char; h: integer; begin h: = getWindow (handle, gw_owner); // getwindow takes a window stunned handle, the window stunning and a source window There is a specific relationship getWindowText (H, S, 300); // getWindowText takes a form header (CAPTION) text, or control content edit1.text: = INTOSTR (H); label1.caption: = s; end; == ========================== GetWindowTextLength Survey Window Title Text or Control content The length of the content GetWindowWord gets the information of the specified window stunning structure Inflaterect increases or decreases Small rectangular size INTERSECTRECT This function is loaded into a rectangle in LPDestRect, which is LPSRC1RECT and LPSRC2RECT two rectangular intersection inValidateRect blocking all or part of the area ischild's all or part of the area ischild to determine if a window is another window. Sub or affiliated window 囗 Isiconic determined whether ISRECTEMPTY determines whether a rectangle is empty iswindow to determine if a window hose is a valid IsWindowEnableD determination window 囗 is active IsWindowUnicode to determine whether a window is a Unicode window. This means that the window scorpion receives unicode text iswindowVisible to all text-based messages. Is it visual i om 囗 囗 化 化 化 化 消 消 消 消 消 消 消 囗 囗 囗 囗 囗 囗 囗 囗 囗 囗 囗 囗A window 囗 Customer Coordinate System MoveWindow changes the location and size of the specified window 囗 OFFSTRECT to allow the rectangle to restore a minimized program by applying a specified offset, allowing the rectangle to restore a minimized program, and activate the PtinRect to determine whether the specified point is located Rectangular Interior RedrawWindow Heavy Pictures All or Several Windows ReleaseCapture Releases the Current Application Mouse Capture ScreenToClient Judgment Screen On a Specify Point Customer Area Coordinate ScrollWindow Scroll Window Customer Zone All or ScrollWindowEx According to the Additional Options, Scroll Window Customers All or part of the area, set the specified window, setcapture, set the mouse capture to the specified window, setclasslong, set a long variable entry setting for the window. SetClassWord Sets an entry set set FocusAPI Set the input focus to the specified window.

If necessary, activate the window stun setForegroundWindow Set the front-end window of the window to the system setparent Specifies the new parent setRect of a window. SetRectempty Set the rectangular SetRectempty Set the rectangle to set the SETWINDOWCONTEXTHELPID to set the help scene for the specified window. (Context) ID setWindowl in the window stunning structure Setting information setWindowPlacement Settings Window Status and Location Information SetWindowPos Specifies a New Location and Status SetWindowText Setting Window Title text or control content setWindowWord in the window Structure SHOWNEDPOPUPS Display or Hide Shotwindowasync with SHOWWINDOWASYNC with ShowWindow SubtractRECT Loading Rectangle Lprcdst, LPRCSRC1, LPRCSRC2, LPRCSRC2 The resultWindows is arranged in a tiled sequential arrangement window. UnionRect is loaded with an LPDESTRECT target rectangle. It is the result of LPSRC1RECT and LPSRC2RECT. UPDATEWINDOW Mandatory Immediate Update All or Section of the ValidateRect The WindowFromPoint returns to the specified point. Handle of the window. Ignore the mask, hidden and transparent window ========================================== ============ Hardware and system functions ---------------- ActivateKeyboardLayout activates a new keyboard layout. Keyboard layout defines the position and meaning of the button on a physical keyboard --------------------------- VB Declaration Declare Function ActivateKeyboardLayout LIB "User32" Alias ​​"ActivateKeyboardLayout" (Byval Flags As Long) AS Long Description Activate a new keyboard layout. The keyboard layout defines the key to the position and the meaning of the key on a physical keyboard, such as execution, returns the handle of the previous keyboard layout; zero means failure. Set the GetLasTerror parameter type and description HKL Long, specify a handle of a keyboard layout. This layout is loaded with the LoadKeyboardLayout or getKeyboardLayoutList function.

You can also activate the next loading layout with the HKL_NEXT constant; or use the HKL_PREV to load the previous layout Flags long, move the specified keyboard to the beginning of the internal keyboard layout list ============== ================================================ BEEP is used to generate a simple sound Chartooem will String from the ANSI character set to the OEM character set CLIPCURSOR limits the pointer to the specified area ConvertDefaultLocale Create a special place identifier into a real place ID CREATECARET Create an insert (cursor) according to the specified information, and select it as Default Insert DESTROYCARET Clear (Destroy) One Insert EnumcalendarInfo Enumeration Enumerates Enumered In Specifies the Calendar Information EnumdateFormats available in the "Local" environment Enumered for the long, short date format enumsystemcodePages enumeration system The installed or supported code page enumsystemlocales enumeration system Setting or providing supports EnumTimeFormats Enumerates ENUMTIMEFORMATS Enumerates a specified place to apply the time format EXITWINDOWSEX exits Windows, restart the ExpandenvironmentStringsTrings Translation specified by specific options The environmental string block getAcp judges the currently effective ANSI code page getasyncKeyState determines the function call to specify the virtual key. GetCareTblinkTime determines the flashing frequency of the insertion target GetCareTPOS determines the current position of the insertion. GetClipCursor obtains a rectangle for describing the current mouse. The cut zone of the pointer GetCommandline gets getCommandline getComputername to the current command line buffer gets the name getCPinfo of this computer gets the information related to the specified code page. GetCurrencyFormat is set for the specified "place" setting, format a number in the currency format GetCursor. Get the handle of the currently selected mouse pointer getCursorpos gets the current location of the mouse pointer getDateformat for the specified "local" format, format the GetDoubleClicktime to determine the continuous two mouse clicks to be processed. The interval between the double-cracked event GetEnvironmentStrings assigns and returns a handle GetNVironmentVariable to get a functional variable to get any environment variables to obtain any environmental variables GetInputState to determine whether there is any pending (wait processing) mouse or keyboard event getkbcodepage by getoemcp substitution, both functionally identical GetKeyboardLayout get a handle description given application system is suitable keyboard layout GetKeyboardLayoutList get a list of all keyboard layouts GetKeyboardLayoutName get the name of the currently active keyboard layout GetKeyboardState made each virtual key on the keyboard the current state GetKeyboardType Understand the information related to the keyboard that is using the keynametext, judge the key name getKeyState when given the processed button, in the process of being processed,

Determine the state GetLastError specifying the virtual key for the previously called API function, with this function to obtain extended error message getLocaleInfo acquire information related to the specified "place" get the local date and time GetNumberformat for the specified "place", according to a specific format queue pending windows code page GetQueueStatus determination application message of a digital GetOEMCP determined between the OEM and ANSI character set conversion (pending) message type GetSysColor whether the specified windows display color GetSystemDefaultLangID of image acquiring default language ID GetSystemDefaultLCID system The current default system "Place" getSystemInfo acquires information related to the underlying hardware platform GetSystemMetrics Returns the information related to the Windows environment GetSystemPowerStatus gets the information related to the current system power status gets the current system time. This time is "Collaboration World Time "(Ie UTC, also known as GMT) format getSystemTimeAdjustment makes the internal system clock with an external clock signal source synchronous GetThreadLocale Locate ID GetTickCount to get the time length (milliseconds) GetTimeFormat, since Windows startup," GetTimeFormat for the current designated "Local", format a system time in a specific format GetTimeZoneInformation to get information about the system time zone settings GetUserDefaultLangID to get the default language ID GetUserDefaultlcid get the current user's default "place" setting getUsername get the current user's name GetVersion to determine the current operation Windows and DOS Version GetversionEx acquires version information related to platform and operating system Hidecaret Hide Insert (Cursor) IsValidCodePage to determine if a code page is valid. IsValidLocale Judgment Local identifier Is Valid KeyBD_Event This function simulates keyboard action loadingKeyboardLayout Load a keyboard layout MapVirtualKey to perform different scan code and character to convert MAPV according to the specified mapping type IRTUALKEYEX performs different scan code and characters to play a system sound based on the specified mapping type.

The allocation scheme of the system sound is the mouse_event to simulate a mouse event OemKeyscan to determine the scan code of an ASCII character in the OEM character set and the SHIFT key state OEMTOCHAR convert a string of the OEM character set to the ANSI character set setCareTblinkTime specified insertion Flashing Frequency SetCaretPos Specifying the PixcMomputername Settings SetComputerName Set New Computer Name SetCursor Sets the specified mouse pointer to the current pointer setCursorpos Set Pointer location setoubleClickTime Settings Continuous Two mouse clicks to make the system think that you can make the system The interval of events setEnvironmentvariable Set an environment variable to specified Value SetKeyboardState Set the status setLocaleInfo on the keyboard to change the user "place" setting information setLocalTime Settings Current Time SetsysColors Settings Specify Window Show Color Setsystemcursor Changing any standard system pointer setsystemTime Settings Current System Time SetsystemTimeAdJustment Timed Add a calibration value to make the internal system clock with an external clock signal source Synchronization setthreadLocale Setting the location for the current thread Settings Settings System Time zone information showcaret Display insert in the specified window (Cursor) showcursor Controls the visibility of the mouse pointer SwapMouseButton decides whether the function of the mouse button is hieramparametersInfo gets and sets the number of Windows system SYSTEMTIMETOTZSPECIFICLOCALTIME converts the system time to local time toascii according to the current scan code and keyboard information, Convert a virtual key to the ASCII character TOUNICODE according to the current scan code and keyboard information, convert a virtual key into a Unicode character unloadKeyboardLayout Uninstall a specified keyboard layout vkkeyscan for Windows character set an ASCII character, determine the status of the virtual key code and SHIFT End ================================================== ===== Menu function ---------- ----- Appendmenu Add a menu item in the specified menu --------------------------------- ----- VB Declaration Declare Function Appendmenu LIB "User32" ALIAS "Appendmenua" (Byval WFLAGS As Long, Byval WidnewItem As Any) AS Long Description Add a menu in the specified menu The return value of the item, the non-zero means success, and zero means failed. Setting the GetLasTerror parameter type and description HMENU Long, menu handle WFLAGS long, the menu constant flag definition table in the ModifyMenu function, list all constant WidnewItem Long, specify the new command ID of the menu entry .

If the MF_POPUP field is specified in the WFLAGS number, this should be a handle of a pop-up menu LPNewItem String (corresponding VB declaration), if the MF_STRING flag is specified in the WFLAGS number, which represents in the menu Set string. If the MF_bitmap flag is set, this represents a long type variable, which contains a bitmap sector.

As set MF_OWNERDRAW, this value will be included in the DRAWITEMSTRUCT and MEASUREITEMSTRUCT structure, transmitted by the windows when an entry needs to be redrawn out annotations Declare Function AppendMenu & Lib "user32" Alias ​​"AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long BYVAL WIDNEWITEM AS STRING ======================================== == CheckMenuItem check or revoke the specified menu entry CheckMenuradioItem Specify a menu entry to create a new menu cretePopUpMenu Create an empty pop-up menu DeleteMenu Remove the specified menu DestroyMenu Delete the specified menu DrawMenuBar specified window imports draw the menu EnableMenuItem allow or prohibit the specified menu item GetMenu acquisition window imports in a menu handle GetMenuCheckMarkDimensions returns a menu check character size GetMenuContextHelpId made which entry help scene ID GetMenuDefaultItem determination menu a menu of It is the default entry GetMenuItemCount Return to menu (menu item) Number of entries (menu item) GetMenuItemID Returns menu ID getMenuItemInfo at the specified location in the menu to get (reception) to load specific information related to a menu entry GetMenuiteMRECT load specified menu entry in a rectangle The screen coordinate information get MeNUSTATE obtains information about the specified menu entry status gets the specified menu entry string getSubMenu to obtain a handle of a pop-up menu, which is located in the menu GetSystemMenu gets the system menu of the specified window HiliteMenuItem Handle HiliteMenuiteM control Highlights the menu entry InsertMenu inserts a menu entry at the specified location of the menu, and puts other entries down to move the INSERTMENUITEM inserted into a new menu entry isMenu to determine whether the specified handle is To load a menu loadMenu from the specified module or application instance Load a menu loadMenuIndirect load a menu MenuItemFromPoint Which menu entry contains a specified point MODIFYMENU to change the menu entry RemoveMenu Remove the specified menu entry SetMenu Settings Window囗 Menu SetMenuContexthelpid Set a menu Help Scene IDSetMenudefaultItem Sets a menu entry to the default entry SetMenuItemBitmaps Set a specific bitmap, which is used in the specified menu entry, replacing the standard check symbol () setMenuiteminfo as a menu entry setting The specified information TRACKPOPUPMENU is displayed in any place on the screen. Displaying a pop-up menu TRACKPOPUPMENUEX is similar to TRACKPOPUPMENU.

Just provides additional feature The following is a few of the type definition of the menu function. Menuiteminfo contains the structure of the menu entry. TPMPARAMS is used for the TRACKPOPUPMENUEX function to support additional function ========== ============================================================================================================================================================================================================ --- AbortPath Abandon all paths in the specified device scenario. Also canceled the creation of any path currently ongoing ------------------------------------- ------------------------------- VB Declaration Declare Function AbortPath LIB "GDI32" Alias ​​"AbortPath" (Byval HDC As Long AS long description Abandon all paths in the specified device scenario. It is also canceled that the creation of any paths currently ongoing, and the non-zero means success, and zero means fail. Setting the GetLasTerror parameter type and description HDC Long, device scene ===================================== = Anglearc Painting with a connection arc --------------------------- VB Declaration Declare Function Anglearc LIB "GDI32" Alias ​​"Anglearc (Byval HDC As Long, Byval X As Long, Byval Y As Long, Byval Double, Byval EsWeepangle As Double) AS Long Description A line of connection arc is drawn, and the test is annotated. Non-zero means successful, zero means failure 叁 number table 叁 number and description HDC Long, to be a circular center point coordinate DWRADIUS LONG, a circular center point coordinate DWRADIUS LONG, a circular radius EStartangle Double, the angle (in units of the line) eSweepangle Double, the range occupied by the arc (in units of degrees) Note that the number is specified in units of degrees, and it should be single Accuracy (SINGLE) instead of double precision.

The corresponding function declaration is: Declare Function Anglearc & LIB "GDI32" (Byval HDC As Long, Byval X As Long, Byval Y, byval Estartangle As Single, Byval EswePangle As Single). My understanding: The function declared in this article is copied to the VB's API text viewer. The declaration from me came from my entry, and I don't know who is wrong. Description of the number table, press the data type in the declaration replication in the VB's API text viewer.

Please note ============================================= ======= Arc Painting a Arc BeginPath Start a Path Branch Canceldc Cancel the long-term drawing in another thread CHORD Draw a string closeenhmetafile closes the specified enhanced element file device scene and will create new primitives When a file returns a handle Closefigure, when you depict the currently open graphic closemetafile, turn off the currently open graphic CloseMetAfile closes the specified element file device scene, and return a handle COPYENHMETAFILE to the newly created element file to create a copy of the specified enhancement element file (copy) CopyMetAfile creates a copy of the specified (standard) element file Createbrush IndiRect Create a brush createDibPatternbrush on a logbrush data structure, create a brush with a bitmap that is not related to the device to specify a brush style (pattern) CREATEENHMETAFILE Create a enhanced type Module File Equipment Scene CreateHatchBrush Creating a Brush CreateMetafile with Shadow Pattern Creating a Module File Device Scene CreatePatternbrush Creating a Brush Createpen Create a Brush Createpen Indirectire with a specified style, width and color with a specified style, width, and color Creating a brush CreateSolidbrush based on the specified Logpen structure Create a brush DELETEENHMETAFILE Delete the specified enhancement element DELETEMETAFILE Delete the specified element file DeleteObject Delete the GDI object, all system resources that are used are released DrawEdge with specified Style depicts a rectangular border DrawScape Code (ESCAPE) function Sending data directly to display device driver DrawFocusRect One Focus Rectangle DrawFrameControl depicts a standard control DrawState to apply a variety of effects Ellipse to depict one Ellipse, stops a path ENUMENHMETAFILE to define a path ENUMENHMETAFILE by the specified rectangle to enumerate a separate chamber file into a standard Windows element file enumerating a standard Windows chair file enumeration. Record enumObjects enumeration can use the brush and brush Extcreatepen that specifies the device scene to create an extension brush (decorative or geometric) extfloodfill in the specified device scenario, populate a zone FillPath with the currently selected brush, any open graphics in the path, And fill a rectangular flattenPath with the current brush fill a rectangle FLATTENPATH to convert all the curves in a path into line segment floodfill with the currently selected brush to populate a zone FrameRect in a specified device scene with the specified brush around a rectangle. Border GDICOMMENT Add a comment information for the specified enhanced element file device Scenario Add a comment message GDIFLUSH Executes any unresolved drawing Operation GDiGetBatchLimit how many GDI draw commands are specified in the queue GDITBATCHLIMIT how many GDI draw commands can enter the queue GetarcDirection painting arc when,

转载请注明原文地址:https://www.9cbs.com/read-86515.html

New Post(0)