最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Delphi 根據(jù)字符串找到函數(shù)并執(zhí)行的實例

 更新時間:2017年09月03日 16:21:42   投稿:lqh  
這篇文章主要介紹了Delphi 根據(jù)字符串找到函數(shù)并執(zhí)行的實例的相關(guān)資料,希望通過本能幫助到大家實現(xiàn)這樣的功能,需要的朋友可以參考下

Delphi 根據(jù)字符串找到函數(shù)并執(zhí)行的實例

 關(guān)鍵字:MethodAddress:取得方法的地址,這個方法需要是published的。

實例代碼:

unit Unit1; 
 
interface 
 
uses 
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
 Dialogs, StdCtrls; 
 
type 
 
 TShowInfo = procedure(info:string) of object;  //聲明一個procedure類型,參數(shù)和ShowInfo一致 
 
 TForm1 = class(TForm) 
  Button1: TButton; 
  procedure Button1Click(Sender: TObject); 
 private 
  { Private declarations } 
 public 
  { Public declarations } 
 
 published 
  procedure ShowInfo(info:string); 
 end; 
 
var 
 Form1: TForm1; 
 
implementation 
 
{$R *.dfm} 
 
{ TForm1 } 
 
procedure TForm1.ShowInfo(info: string); 
begin 
 ShowMessage(info); 
end; 
 
procedure TForm1.Button1Click(Sender: TObject); 
var 
 s:TShowInfo; 
begin 
 @s := MethodAddress('ShowInfo');    //取得ShowInfo的地址 
 if @s <> nil then           //如果不為空 
 begin 
  s('中華人民共和國');         //執(zhí)行 
 end; 
end; 
 
end. 

如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論

图们市| 凤城市| 永靖县| 简阳市| 盖州市| 泉州市| 吉隆县| 和静县| 阿合奇县| 盐城市| 五华县| 深泽县| 大名县| 乌兰浩特市| 河曲县| 遵化市| 嘉义市| 施秉县| 大埔县| 长丰县| 商都县| 连云港市| 耒阳市| 东山县| 明溪县| 鹰潭市| 城步| 舞阳县| 枣阳市| 大丰市| 凤翔县| 来凤县| 于田县| 清水县| 左贡县| 通许县| 宁乡县| 宁武县| 中山市| 梁山县| 农安县|