Convenient message sending functions such as sendtextmessage

Source: Internet
Author: User
It was suddenly found that the message unit finally provided several convenient message sending functions:
Sendtextmessage, sendstructmessage, sendgetstructmessage, and sendgetintmessage

Although the implementation of functions is very simple, it is indeed much easier to use them to send text, structure, and integers. below is only an example of sendtextmessage:

// The example is to assign a value to edit by sending a message: Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; type tform1 = Class (tform) edit1: tedit; button1: tbutton; button2: tbutton; button3: tbutton; button4: tbutton; Procedure handle (Sender: tobject); Procedure handle (Sender: tobject); Procedure button3click (Sender: tobject); Procedure button4click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} // use the traditional sendmessageprocedure tform1.button1click (Sender: tobject); var STR: string; begin STR: = 'in case 1'; sendmessage (edit1.handle, wm_settext, 0, INTEGER (pchar (STR); end; // use the synchronized mprocedure tform1.button2click (Sender: tobject); var STR: string; begin STR: = 'in case 2 '; edit1.perform (wm_settext, 0, INTEGER (pchar (STR); end; // procedure tform1.button3click (Sender: tobject); var STR: string; begin STR: = 'event 3'; sendtextmessage (edit1.handle, wm_settext, 0, STR); end; // sendtextmessage can also accept the String constant procedure tform1.button4click (Sender: tobject); begin sendtextmessage (edit1.handle, wm_settext, 0, 'in case 4'); end.
 
  
 

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.