Learn message (10): wm_cancelmode message Test

Source: Internet
Author: User
In the start mode window, the current window will receive a message for wm_cancelmode. No parameter is set for the message to be changed.
In this example:


Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) memo1: tmemo; button1: tbutton; button2: tbutton; button3: tbutton; button4: tbutton; Procedure upload (Sender: tobject); Procedure button1click (Sender: tobject); Procedure button2click (Sender: tobject ); procedure button3click (Sender: tobject); Procedure button4click (Sender: tobject); protected procedure success (VAR message: twmcancelmode); message wm_cancelmode; end; var form1: tform1; implementation {$ R *. DFM} procedure alert (Sender: tobject); begin memo1.align: = alleft; cursor: = ssvertical; memo1.clear; position: = poscreencenter; end; Procedure tform1.button1click (Sender: tobject ); begin showmessage ('showmessage'); end; Procedure tform1.button2click (Sender: tobject); begin inputbox ('inputbox', 'input', ''); end; Procedure tform1.button3click (Sender: tobject); begin MessageBox (handle, 'test', 'messagebox', 0); end; Procedure tform1.button4click (Sender: tobject); var form: tform; begin form: = tform. create (Self); form. caption: = 'test'; form. width: = width Div 2; form. height: = height Div 2; form. position: = pow.topcenter; form. showmodal; end; Procedure tform1.wmcancelmode (VAR message: twmcancelmode); begin memo1.lines. add ('receive wmcancelmode message'); message. result: = 0; end.
 
   
 

Form file:

Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 161 clientwidth = 301 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false oncreate = formcreate pixelsperinch = 96 textheight = 13 object memo1: tmemo left = 8 Top = 8 width = 185 Height = 89 lines. strings = ('memo1') taborder = 0 end object button1: tbutton left = 207 Top = 23 width = 75 Height = 25 caption = 'button1' taborder = 1 onclick = button1click end object button2: tbutton left = 207 Top = 54 width = 75 Height = 25 caption = 'button2' taborder = 2 onclick = button2click end object button3: tbutton left = 207 Top = 85 width = 75 Height = 25 caption = 'button3' taborder = 3 onclick = button3click end object button4: tbutton left = 207 Top = 116 width = 75 Height = 25 caption = 'button4' taborder = 4 onclick = button4click endend
 
  
 

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.