Board logo

Subject: [Help]OTA [Print This Page]

Author: jAmEs_    Time: 2009-7-13 13:28     Subject: [Help]OTA

用RegisterDesignNotification 註冊一個Designer的監控器,退出總是會造成異常,不知道要怎麼處理才不會這樣?
http://www.delphigroups.info/2/7/797982.html 這裡有個案例,但是不太明白他們說的解決方法。
Author: jAmEs_    Time: 2009-7-13 13:29

http://bbs.cnpack.org/viewthread.php?action=printable&tid=154
這裡提到這個,但是沒有具體例子。
Author: jAmEs_    Time: 2009-7-13 23:22

好像这样可以解决:
通过变量保存IDesignNotification接口指针,然后结束时,把指针赋值nil。

var
MyNotify:IDesignNotification;

initialization
try
MyNotify:=TMyNotify.Create;
except
MyNotify:=nil;
Raise;
end;
RegisterDesignNotification(MyNotify);

finalization
UnRegisterDesignNotification(MyNotify);
MyNotify:=nil;

end.




Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0