Borland Delphi one-sentence help

Source: Internet
Author: User

1.
If you want yourProgramIf you can correctly handle exceptions, Please reference the sysutils. Pas unit. Otherwise, even if the program uses try... exceptions t..., the exception cannot be correctly captured.

2. String constant array Initialization
Const constarray: array [0 .. 2]
String = ('first ', 'second', 'third ');

3. struct Initialization
Type
Tstructinit = record
A1: integer;
A2: array [0 .. 2] of integer;
End;

Const m_structinit: tstructinit = (A1: 0; a2 :( 0, 1, 2 ));

4. Length of multi-dimensional array

VaR array2: array of integer;
Setlength (array2, 2, 2 );

5. The space opened using create and new exists in the heap and cannot be automatically released. We recommend that you use freeandnil to release the space.

6.
Sizeof is not suitable for objects and always returns 4; it can return a correct value for a fixed type.

7.
Create (NiL) needs to be released manually, and creat (Self) will be released with the release of the owner.

8.
Downto is used repeatedly during the delete operation to avoid errors.

9. the ASCII code of a Chinese character> 128, which can be used to determine whether it is a Chinese character.

10. postmessage only stores messages in the message queue and needs to be queued for processing.

Sendmessage is directly sent to the window without passing through the message queue, and is returned only after the message is returned.

11. Move the mouse in and out of the message: cm_mouseenter, cm_mouseleave.

12. Send a message to get the number of all files in a directory and display the file names of all files in The ListBox control.
Const
Dirattr
= Ddl_readwrite or ddl_readonly or
Ddl_archive;

Listbox1.items. Clear;
Sendmessage (listbox1.handle,
Lb_dir, dirattr, INTEGER (pchar ('C /*.*')));
Filenum: =
Listbox1.items. count;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.