| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> DELPHI zhong de xiao xi chu li ji zhi

DELPHI zhong de xiao xi chu li ji zhi

2006-12-16 17:27:52 编辑來源:互联网 评论
 
 
 
本文为【DELPHI中的消息处理机制】的拼音翻译版
  Delphi shi Borland gong si ti gong de yi zhong quan xin de WINDOWS bian cheng kai fa gong ju . you yu ta cai yong le ju you tan xing de he ke chong yong de mian xiang dui xiang Pascal(object-oriented pascal) yu yan , bing you qiang da de shu ju ku yin qing (BDE), kuai su de dai ma bian yi qi , tong shi you ti gong le zhong duo chu se de gou jian . shou dao guang da bian cheng ren yuan de qing lai . zai zhong duo de bian cheng yu yan ( ru VB,PowerBuilder,Powerpoint deng ) zhong tuo ying er chu . qi zhong yi ge DELPHI qiang yu qi ta bian cheng yu yan ( ru VB4.0) de di fang jiu shi zai DELPHI zhong ke zi ding yi xiao xi , bing ke zhi jie chu li xiao xi . zhe dui yu na xie xi wang bian xie zi ji de gou jian (Component), huo zhe xi wang jie huo . guo lv xiao xi de yong hu lai shuo shi bi bu ke shao de . yin wei bian xie gou jian yi ban yao dui xiang ying de xiao xi jin xing chu li . xia mian jiu dui Delphi zhong xiao xi chu li ji zhi jin xing yi xia jie shao 。
  yi .DELPHI VCL zhong xiao xi de chuan di
  Delphi zhong mei yi ge VCL(Visual Component Library) gou jian ( ru Tbutton,Tedit deng ) dou you yi nei zai de xiao xi chu li ji zhi , qi ji ben dian jiu shi gou jian lei jie shou dao mou xie xiao xi bing ba ta men fa song gei shi dang de chu li fang fa , ru guo mei you te ding de chu li fang fa , ze tiao yong que sheng de xiao xi chu li ju bing 。
  qi zhong mainwndproc shi ding yi zai Twincontrol lei zhong de yi ge jing tai fang fa , bu neng bei chong zai (Override)。 ta bu zhi jie chu li xiao xi , er shi jiao you wndproc fang fa chu li , bing wei wndproc fang fa ti gong yi ge yi chang chu li mo kuai 。Mainwndproc fang fa sheng ming ru xia :
  procedure MainWndProc(var Message: TMessage);
  Wndproc shi zai Tcontrol lei zhong ding yi de yi ge xu ni fang fa , you ta tiao yong dispatch fang fa lai jin xing xiao xi de fen pei , wndproc fang fa sheng ming ru xia :
  procedure WndProc(var Message: TMessage); virtual;
  dispatch fang fa shi zai Tobject gen lei zhong ding yi de , qi sheng ming ru xia :
  procedure Tobject.dispatch(var Message); chuan di gei dispatch de xiao xi shen shu bi xu shi yi ge ji lu lei xing , qie zhe ge ji lu zhong di yi ge ru dian bi xu shi yi ge cardinal lei xing de yu (field), ta bao han le yao fen pei de xiao xi de xiao xi hao ma . li ru :
  type
  Tmessage=record
  Msg:cardinal;
  wparam:word;
  lparam:longint; .
  result:longint;
  end;
  er Dispatch fang fa hui gen ju xiao xi hao ma tiao yong gou jian de zui hou dai lei zhong chu li ci xiao xi de ju bing fang fa . ru guo ci gou jian he ta de zu xian lei zhong dou mei you dui ying ci xiao xi de chu li ju bing ,Dispatch fang fa bian hui tiao yong Defaulthandler fang fa .Defaulthandler fang fa shi ding
  yi yu Tobject zhong de xu ni fang fa , qi sheng ming ru xia :
  procedure Defaulthandler(var Message);virtual;
  Tobject lei zhong de Defaulthandler fang fa zhi shi shi xian jian dan de fan hui er bu dui xiao xi jin xing ren he de chu li . wo men ke yi tong guo dui ci xu ni fang fa de chong zai , zai zi lei zhong shi xian dui xiao xi de que sheng chu li . dui yu VCL zhong de gou jian er yan , qi Defaulthandler fang fa hui qi dong windows API han shu Defwindowproc dui xiao xi jin xing chu li .
  er .DELPHI zhong de xiao xi chu li ju bing
  zai DELPHI zhong yong hu ke yi zi ding yi xiao xi ji xiao xi chu li ju bing . xiao xi chu li ju bing de ding yi you ru xia ji ge yuan ze :
  1. xiao xi chu li ju bing fang fa bi xu shi yi ge guo cheng , qie zhi neng chuan di yi ge Tmessage xing bian liang shen shu .
  2. fang fa sheng ming hou yao you yi ge message ming ling , hou jie yi ge zai 0 dao 32767 zhi jian de xiao xi biao hao ( zheng xing chang shu ).
  3. xiao xi chu li ju bing fang fa bu xu yao yong override ming ling lai xian shi zhi ming chong zai zu xian de yi ge xiao xi chu li ju bing , ling wai ta yi ban sheng ming zai gou jian de protected huo private qu .
  4. zai xiao xi chu li ju bing zhong yi ban xian shi yong hu zi ji dui xiao xi de chu li , zui hou yong inherited ming ling tiao yong zu xian lei zhong dui ying ci xiao xi de chu li ju bing ( you xie qing kuang xia ke neng zheng xiang fan ).
  you yu ke neng dui zu xian lei zhong dui ci xiao xi de chu li ju bing de ming zi he shen shu lei xing bu qing chu , er tiao yong ming ling inherited ke yi bi mian ci ma fan , tong yang ru guo zu xian lei zhong mei you dui ying ci xiao xi de chu li ju bing ,inherited jiu hui zi dong tiao yong Defaulthandler fang fa .( dang ran ru guo yao ping bi diao ci xiao xi , jiu bu yong inherited ming ling le )。
  xiao xi chu li ju bing fang fa sheng ming wei :
  procedure Mymsgmethod(var message:Tmessage); message Msgtype;
  tong yang yong hu ye ke yi ding yi zi ji de xiao xi , yong hu zi ding yi xiao xi ying cong WM_USER kai shi .
  zi ding yi xiao xi ji xiao xi chu li ju bing ju li ru xia :
  const my_paint=Wm_user+1;
  type
  Tmypaint=record
  msgid:cardinal;
  msize:word;
  mcolor:longint;
  msgresult:longint;
  end;
  type
  Tmycontrol=class(TCustomControl)
  protected
  procedure change(var message:Tmypaint); message my_paint;
  .....
  end;
  ......
  procedure Tmycontrol.change(var message:Tmypaint);
  begin
  size:=message.msize; { she zhi Tmybutton chi cun shu xing }
  color:=message.mcolor; { she zhi Tmybutton yan se shu xing }
  {do something else}
  inherited; { jiao you Tcustomcontrol chu li }
  end;【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
Delphi shi Borland gong si ti gong de yi zhong quan xin de WINDOWS bian cheng kai fa gong ju . you yu ta cai yong le ju you tan xing de he ke chong yong de mian xiang dui xiang Pascal(object-oriented pascal) yu yan , bing you qiang da de shu ju ku yin qing (BDE), kuai su de dai ma bian yi qi , tong shi you ti gong le zhong duo chu se de gou jian . shou dao guang da bian cheng ren yuan de qing lai . zai zhong duo de bian cheng yu yan ( ru VB,PowerBuilder,Powerpoint deng ) zhong tuo ying er chu . qi zhong yi ge DELPHI qiang yu qi ta bian cheng yu yan ( ru VB4.0) de di fang jiu shi zai DELPHI zhong ke zi ding yi xiao xi , bing ke zhi jie chu li xiao xi . zhe dui yu na xie xi wang bian xie zi ji de gou jian (Component), huo zhe xi wang jie huo . guo lv xiao xi de yong hu lai shuo shi bi bu ke shao de . yin wei bian xie gou jian yi ban yao dui xiang ying de xiao xi jin xing chu li . xia mian jiu dui Delphi zhong xiao xi chu li ji zhi jin xing yi xia jie shao 。 yi .DELPHI VCL zhong xiao xi de chuan di   Delphi zhong mei yi ge VCL(Visual Component Library) gou jian ( ru Tbutton,Tedit deng ) dou you yi nei zai de xiao xi chu li ji zhi , qi ji ben dian jiu shi gou jian lei jie shou dao mou xie xiao xi bing ba ta men fa song gei shi dang de chu li fang fa , ru guo mei you te ding de chu li fang fa , ze tiao yong que sheng de xiao xi chu li ju bing 。    qi zhong mainwndproc shi ding yi zai Twincontrol lei zhong de yi ge jing tai fang fa , bu neng bei chong zai (Override)。 ta bu zhi jie chu li xiao xi , er shi jiao you wndproc fang fa chu li , bing wei wndproc fang fa ti gong yi ge yi chang chu li mo kuai 。Mainwndproc fang fa sheng ming ru xia :   procedure MainWndProc(var Message: TMessage); Wndproc shi zai Tcontrol lei zhong ding yi de yi ge xu ni fang fa , you ta tiao yong dispatch fang fa lai jin xing xiao xi de fen pei , wndproc fang fa sheng ming ru xia :   procedure WndProc(var Message: TMessage); virtual; dispatch fang fa shi zai Tobject gen lei zhong ding yi de , qi sheng ming ru xia : procedure Tobject.dispatch(var Message); chuan di gei dispatch de xiao xi shen shu bi xu shi yi ge ji lu lei xing , qie zhe ge ji lu zhong di yi ge ru dian bi xu shi yi ge cardinal lei xing de yu (field), ta bao han le yao fen pei de xiao xi de xiao xi hao ma . li ru :   type    Tmessage=record    Msg:cardinal;    wparam:word;    lparam:longint; .    result:longint;   end; er Dispatch fang fa hui gen ju xiao xi hao ma tiao yong gou jian de zui hou dai lei zhong chu li ci xiao xi de ju bing fang fa . ru guo ci gou jian he ta de zu xian lei zhong dou mei you dui ying ci xiao xi de chu li ju bing ,Dispatch fang fa bian hui tiao yong Defaulthandler fang fa .Defaulthandler fang fa shi ding yi yu Tobject zhong de xu ni fang fa , qi sheng ming ru xia :   procedure Defaulthandler(var Message);virtual; Tobject lei zhong de Defaulthandler fang fa zhi shi shi xian jian dan de fan hui er bu dui xiao xi jin xing ren he de chu li . wo men ke yi tong guo dui ci xu ni fang fa de chong zai , zai zi lei zhong shi xian dui xiao xi de que sheng chu li . dui yu VCL zhong de gou jian er yan , qi Defaulthandler fang fa hui qi dong windows API han shu Defwindowproc dui xiao xi jin xing chu li .    er .DELPHI zhong de xiao xi chu li ju bing    zai DELPHI zhong yong hu ke yi zi ding yi xiao xi ji xiao xi chu li ju bing . xiao xi chu li ju bing de ding yi you ru xia ji ge yuan ze :   1. xiao xi chu li ju bing fang fa bi xu shi yi ge guo cheng , qie zhi neng chuan di yi ge Tmessage xing bian liang shen shu .   2. fang fa sheng ming hou yao you yi ge message ming ling , hou jie yi ge zai 0 dao 32767 zhi jian de xiao xi biao hao ( zheng xing chang shu ).   3. xiao xi chu li ju bing fang fa bu xu yao yong override ming ling lai xian shi zhi ming chong zai zu xian de yi ge xiao xi chu li ju bing , ling wai ta yi ban sheng ming zai gou jian de protected huo private qu .   4. zai xiao xi chu li ju bing zhong yi ban xian shi yong hu zi ji dui xiao xi de chu li , zui hou yong inherited ming ling tiao yong zu xian lei zhong dui ying ci xiao xi de chu li ju bing ( you xie qing kuang xia ke neng zheng xiang fan ). you yu ke neng dui zu xian lei zhong dui ci xiao xi de chu li ju bing de ming zi he shen shu lei xing bu qing chu , er tiao yong ming ling inherited ke yi bi mian ci ma fan , tong yang ru guo zu xian lei zhong mei you dui ying ci xiao xi de chu li ju bing ,inherited jiu hui zi dong tiao yong Defaulthandler fang fa .( dang ran ru guo yao ping bi diao ci xiao xi , jiu bu yong inherited ming ling le )。    xiao xi chu li ju bing fang fa sheng ming wei :   procedure Mymsgmethod(var message:Tmessage); message Msgtype; tong yang yong hu ye ke yi ding yi zi ji de xiao xi , yong hu zi ding yi xiao xi ying cong WM_USER kai shi . zi ding yi xiao xi ji xiao xi chu li ju bing ju li ru xia :   const my_paint=Wm_user+1;   type    Tmypaint=record    msgid:cardinal;    msize:word;    mcolor:longint;    msgresult:longint;   end;   type    Tmycontrol=class(TCustomControl)    protected    procedure change(var message:Tmypaint); message my_paint;     .....    end;    ......   procedure Tmycontrol.change(var message:Tmypaint);   begin    size:=message.msize; { she zhi Tmybutton chi cun shu xing }    color:=message.mcolor; { she zhi Tmybutton yan se shu xing }    {do something else}    inherited; { jiao you Tcustomcontrol chu li }   end;
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
赏心悦目的模特儿(9)
赏心悦目的模特儿(8)
赏心悦目的模特儿(7)
赏心悦目的模特儿(6)
周六一日游--绿野翠蜂场(一)
骆驼峰
下一站上环
杂乱的几张Danang
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有