Delphi basic development skills (not regret!)

zhaozj2021-02-16  45

Delphi Basic Development Skills [Delphi] Network Neighbor Replication Document Uses Shellapi; CopyFile (Pchar ('NewFile.txt'), Pchar ('// Computername / Direction / Targer.txt'), False); ◇ [Delphi] Generate mouse Drag Effects through the Mousemove event, Dragover event, Enddrag event implementation, such as Label: Var XPanel, Ypanel, XLabel, Ylabel: Integer, XLabel, Ylabel: Integer; XPanel: = X; YPANEL: = Y; PANEL DRAGOVER Event: xPanel: = X; YPANEL: = Y; Label Mousemove Event: xLabel: = x; ylabel: = y; Label's endDrag event: label.Left: = xPanel-xlabel; label.top: = YPANEL-YLABEL; ◇ [Delphi] gets Windows catalog Uses shellapi; var window, array [0..255] of char; getWindowsDirectory; or read from the registry, location: hkey_local_machine / Software / Microsoft / WINDOWS / CURRENTVERSIONSYSTEMROOT button, acquisition, C: / Windows ◇ [Delphi] Pipeline VAR X, Y: Array [0..50] of integer; canvas.pen.color: = CLRED; Canvas.Pen .style: = psdash; form1.canvas.moveto (Trunc (x [i]), trunc (y [i])); Form1.canvas.LineTo (Trunc (x [j]), trunc (y]) ); ◇ [Delphi] string list uses var tips: tstringlist; tips: = tstringlist.create; tips.loadfromfile ('filename.txt'); edit1.text: = tips [0]; tips.add ('Last Line Addition string '); Tips.insert (1,' Insert Str ing at NO 2 line '); tips.savetofile (' newfile.txt '); tips.free; ◇ [DELPHI] clipboard simple operation richedit1.selectall; richedit1.copytoclipboard; richedit1.cuttoclipboard; edit1.pastefromclipboard; ◇ [ Delphi] About file, directory operation chDIR ('c: / abcdir'); go to directory mkdir ('DIRNAME'); establish directory RMDir ('DIRNAME'); delete directory getcurrentdir; // Take the current directory name, no '/ 'Getdir (0, s); // Take the work directory name S: =' c: / abcdir '; deleetfile (' abc.txt '); // Remove file renamefile (' ild.txt ',' new.txt ' ); // file rename extractFileName (filename); // Take a file name extractFileExt (filelistbox1.filename); // Take a file suffix ◇ [Delphi] Process file attribute attr: = filegetttr (fileEListBox1.filename); if (Attr And fareadonly) =

Fareadonly kiln ... // read-only if (attr and fasysfile) = fasysfile kiln ... // System IF (attr and faarch) = faarchive dam // Archive IF (attr and fahidden) = Fahidden Then .. . // Hide ◇ [Delphi] Execute the program external file Winexec // Call the executable WINEXEC ('Command.com / c copy *. * C: /', sw_normal); Winexec ('start abc.txt'); Shellexecute Or SHELLEXECUTEEX // Start File Related Program Function Executefile (const filename, params, defaultdir: string; showcmd: integer): thandle; executefile ('c: /abc/a.txt', 'x.abc', 'C: / ABC / ', 0); Executefile (' http: //tingweb.yeah.net', '' ,'',0); Executefile (' Mailto: tingweb@wx88.net ',' ',', 0) ; ◇ [DELPHI] acquiring system running process name var hCurrentWindow: HWnd; szText: array [0..254] of char; beginhCurrentWindow: = Getwindow (handle, GW_HWndFrist); while hCurrentWindow <> 0 dobeginif Getwindowtext (hcurrnetwindow, @ sztext , 255)> 0 THEN ListBox1.items.add (@sztext)); hcurrentWindow: = getWindow (hcurrentwindow, gw_hwndnext); end; end; ◇ [delphi] About assembly analog ASM END; can modify Eax, ECX , EDX; You cannot modify ESI, EDI, ESP, EBP, EBX. ◇ [Delphi] About Type Conversion Function FLOATTOSTR / / Floating Stroke FloatTostrf // Floating Stroke InttoHex // Integer Transfer 16 Enter TimetostrDateTrDateTiMetostrfMTSTRDATSTRDATSTRFMTSTRDATSTRDATSTRDTSTRDATSTRFMTSTR / / Output String FormatDateTime ('YYYY-MM) -DD, HH-MM-SS ', date); ◇ [Delphi] String process and function INSERT (OBJ, Target, POS); // String Target is inserted in POS. If the insertion result is greater than the maximum length of Target, multiple characters will be cut off. Such as POS is 255, it will generate an error. For example, st: = 'brian', INSERT ('OK', ST, 2) will make ST to 'Brokian'. Delete (ST, POS, NUM); // From the POS (integer) position in the ST string, the number of substrings of NUM (integer) characters are started. For example, st: = 'brian', the delete (ST, 3, 2) will become BRN. Str (Value, ST); // Convert value value (integer or real) into a string in ST. For example, when A = 2.5E4, the STR (A: 10, ST) will make the value of the ST '25000'. VAL (ST, VAR, CODE); // converts string expressions to a corresponding integer or real value, stored in VAR. St must be a string representing a value and complies with the rules of the numerical constant. During the conversion process, if an error is not detected, the variable code is set to 0, otherwise it is positioned as the first error character.

For example, st: = 25.4e3, X is a real variable, the VAL (ST, X, CODE) will make the X value of 25400, the Code value is 0. Copy (st.pos.num); // Returns a substring containing Num (integer) characters at a position POS (integer) in the ST string. If the POS is greater than the length of the ST string, it will return an empty string. If POS is outside 255, it will cause an error. For example, st: = 'brian', then COPY (ST, 2, 2) returns 'ri'. Concat (ST1, ST2, ST3 ..., STN); // Connect all the strings indicated by all the variables, and returns the connected value. If the length 255 of the result will generate an operation error. For example, St1: = 'brian', ST2: = '', ST3: = 'WILFRED', then CONCAT (ST1, ST2, ST3) returns 'Brian Wilfred'. Length (ST); // Returns the length of the string expression ST. For example, St: = 'brian', the longth (ST) returns 5. POS (OBJ, TARGET); // Returns the first appearance of the string OBJ at the target string Target, if the target does not match the string, the return value of the POS function is 0. For example, Target: = 'Brian Wilfred', the return value of POS ('WIL', TARGET) is 7, and the return value of POS ('Hubet', Target) is 0.

◇ [Delphi] About Processing Registry Uses Registry; Var REG: Tregistry; Reg: = Tregistry.create; REG.ROOTKEY: = 'HKEY_CURRENT_USER'; Reg.OpenKey ('Control Panel / Desktop', false); reg.writestring 'Title Wallpaper', '0'); reg.writeString ( 'Wallpaper', filelistbox1.filename); reg.closereg; reg.free; ◇ [DELPHI] on the keyboard constant name VK_BACK / VK_TAB / VK_RETURN / VK_SHIFT / VK_CONTROL / VK_MENU / VK_PAUSE / VK_ESCAPE / VK_SPACE / VK_EFT / VK_RIGHT / VK_UP / VK_DOWNF1 - F12: $ 70 (112) - $ 7B (123) AZ: $ 41 (65) - $ 5A (90) 0-9: $ 30 (48) $ 39 (57) ◇ [Delphi] Preliminary judgment program Native DELPHI software DOS Tips: This Program Must Be Run Under Win32.VC software DOS Tip: This Program Cannot Be Run in Dos Mode. ◇ [Delphi] Operation Cookieresponse. Cookies ("name") .Domain: = 'http://www.086net.com'; with response.cookies.add dobeginname: = 'username'; value: = 'username'; END ◇ [Delphi] Add to Document Menu connection Uses shellapi, shlobj; shaddtorecentdocs (Shard_path, pchar (filepath))); // Added ShaddtorecentDocs (Shard_Path, NIL); // Empty ◇ [Miscellaneous] Backup Intelligent ABC Input French Word Windows / System / User.RemWindows /system/tmmr.rem ◇ [Delphi] Judgment Mouse button if getasynckeyState (vk_lbutton) <> 0 THEN ... // Left button if getasynckeyState (vk_mbutt "ON) <> 0 THEN ... / / Middle key if getasynckeystate (vk_rbutton) <> 0 THEN ... / / Right button [Delphi] Set the maximum display of the Form onFormCreate event Self.Width: = Screen.width; Self .height: = screen.height; ◇ [DELPHI] button OnCreate event message receiving processing: Application.OnMessage: = MyOnMessage; procedure TForm1.MyOnMessage (var MSG: TMSG; var handle: Boolean); beginif msg.message = 256 then ... // any key if msg.Message = 112 Then ... // f1if msg.Message = 113 Then ... // f2nd; ◇ [Miscellaneous] hidden shared folder sharing effect: Access, but not Visible (in resource management, network neighbors) Take a shared name: Direction $ Access: // Computer / Dirction / ◇ [Java Script] Java Script page Common Effects page 60 seconds Turn