(*) FORM Fade 1) AnimateWindow (Form1.Handle, 1000, AW_BLEND); // Fracture into AnimateWindow (Form1.Handle, 1000, AW_HIDE OR AW_BLEND); // Fade 2) The form has alphablend properties and alphablendvalue properties, will Alphablend The property is set to True, then change the value of AlphablendValue (0-255) over time (0-255) over time (0-255), AlphablendValue: = 1; // Form transparent
(*) Form Minimization of capture during a public procedure onminsize (var msg: twmsyscommand); message wm_syscommand; procedure TForm1.onminsize (var msg: twmsyscommand); begin if msg.CmdType = SC_MINIMIZE then begin form1.Width: = 100; Form1.height: = 100; Form1.Left: = 100; Form1.top:=300; EXIT; End; Inherited;
(*) CreateGuid (out newguid) s: = guidtostring (newguid)
(*) Since the top 50: Y: = Round (x)
(*) String: = StringReplace (string1, '*', '#', [rfreplaceAll]);
(*) Has a String enclose the single quotes as String Returns QuoteDSTR (const s: string): String
(*) How to make the content paging in DBGRID display adodataset1.open; adodataset1.recordset.pageSize: = 10; // Display first page adodataset1.recordset.absolutePosition: = 1; adodataset1.recordset.pageSize: = 10; // Display the second page adodataset1.recordset.absoluteposition: = 11;
(*) Achieved resolve the IP address for a host uses WinSock process is as follows: function IPAddrToName (IPAddr: String): String; var SockAddrIn: TSockAddrIn; HostEnt: PHostEnt; WSAData: TWSAData; begin WSAStartup ($ 101, WSAData); SockAddrIn.sin_addr. s_addr: = inet_addr (PChar (IPAddr)); hostEnt: = gethostbyaddr (@ SockAddrIn.sin_addr.S_addr, 4, AF_INET); if hostEnt <> nil then begin result: = StrPas (hostent ^ .h_name) end else begin result: = '; End; end; use function: var name: string; begin name: = inputbox (' Enter the other side host ip ',' host IP address: ',' '); showMessage (iPaddrtoname (Name)); (*) Remove the scrollbar webbrowser1.boleObject.document.body.Scroll,: = 'NO';
(*) TtreeView's node How to have a image property, do three small pictures: all selected, partially selected, ignorant (directly photographing the picture of the three states directly), then On the event, you can set the imageIndex of Ttreenodes based on the specific situation. Heavy Duty Treeview CreateParams: Type TcheckboxTreeView = Class (TtreeView) Protected Procedure CreateParams; Override;
Procedure TcheckboxTreeView.createParams (VAR params: tcreateparams); begin inherited; params.style =paMs.style or TVs_CheckBoxes; {tvs_checkboxes declared in command} end;
To Check the CheckBox, you can use the following code: function IsNodeChecked (Node: TTreeNode): Boolean; const TVIS_CHECKED = $ 2000; var TvItem: TTVItem; begin TvItem.Mask: = TVIF_STATE; TvItem.hItem: = Node.ItemId; TreeView_GetItem (Node.TreeView.handle, TVItem); Result: = (TVItem.State and TV JND) = tvis_checked;
procedure SetNodeChecked (Node: TTreeNode; Checked: Boolean); const TVIS_CHECKED = $ 2000; var TvItem: TTVItem; begin FillChar (TvItem, SizeOf (TvItem), 0); with TvItem do begin hItem: = Node.ItemId; Mask: = TVIF_STATE ; StateMask: = TVIS_STATEIMAGEMASK; if Checked then TvItem.State: = TVIS_CHECKED else TvItem.State: = TVIS_CHECKED shr 1; TreeView_SetItem (Node.TreeView.Handle, TvItem); end; end; event can be made and packaged into a class: Private oldstate: boolean; procedure change (node: ttreenode); OVERRIDE; begin inherited change; oldstate: = isnodeChecked (node);
procedure Click; override; var NewState: Boolean; begin inherited Click; NewState: = IsNodeChecked (Self.Selected); if NewState = OldState then Exit; if (NewState) and Assigned (OnNodeChecked) then OnNodeChecked () else if (not NewState) And assigned (onnodeunchecked) THEN ONDEUNCHECKED ()
// ONNODECHECKED & ONNODEUNCHECKED WILL BE Events That You Declarend;
(*) How to display the data in the stringGrid? (1) Set the stringgrid the defaultdraw: false; (2) procedure TForm1.StringGrid1DrawCell (Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var sText: string; begin with StringGrid1 do begin sText : = Cells [Acol, Arow]; if Stext <> '' Then Begin Canvas.FillRect (Rect); DrawText (Canvas.Handle, Pchar (Stext), Length (Stext), Rect, DT_Center OR DT_VCENTER OR DT_SINGLINE); END ;
DLL gets your path: Windows.getModuleFileName (Hinstance, LP, 100);
CAPTION: = Copy (edit1.text, 3, maxint); // suggestion, less calculation
Get an Explorer handle, thread getWindowThreadProcessId (FindWindow ('Explorewclass', NIL), NIL) FindWindow ('Explorewclass', NIL)
Call Notepad Uses .... shellapi; shellexecute (Handle, NIL, PCHAR ('C: / Windows / NotePad'), NIL, NIL, SW_SHOWNORMAL); replacing Tab in ONKEYPRESS Write if key = # 13 THEN Perform (WM_NEXTDLGCTL, 0, 0);
FieldName Like "% ' GA_FINDVALUE '%" '
Formatfloat ('0.00', doubleValue); // Format Float ---> String
Mailto: whj@aa.com? Subject = SubjectTille (& attctach = c: /config.sys)
// Return to the day number of days Uses sysuitls; // isleapyear ... function daysofmonth (date: tdatetime): Integer; var Y, m, d: word; begin decodate (Date, Y, M, D); Case M Of 2: if isleApyear (Y) Then Result: = 29 else result: = 28; 1, 3, 5, 7, 8, 10, 12: Result: = 31; 4, 6, 9, 11: Result: = 30 ;
// Trigger an error Raise Exception.create ('Delete Table Error');
// Get the IP address (Getip.exe) Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); Var WVersionRequested: Word; Wsadata: Twsadata; P: phostent; s: array [0..128] of char; p2: pchar; Output : array [0..100] of char; becom {start up winsock} wversionRequested: = MakeWord (1, 1); WSAStartup (WVersionRequested, WSADATA);
{Get the computer name} gethostname (@S, 128); p: = gethostbyname (@S);
{Get the ipaddress} p2: = inet_ntoa (PINADDR (P ^ .h_addr_list ^); strpcopy (output, 'hostname:' Format ('% s', [p ^ .H_name]) # 10 # 13 'IP Address:' Format ('% s', [p2])); wsacleanup; MessageBox (0, Output, 'Get IP! - this is your ip address', MB_OK or MB_ICONITION);