SocketConnection.BeforeDisconnect:=Addr(SocketConnectionBeforeDisconnect);
SocketConnection.BeforeDisconnect:=TNotifyEvent(SocketConnectionBeforeDisconnect);
都出错,我很弱的
SocketConnection.BeforeDisconnect:=TNotifyEvent(SocketConnectionBeforeDisconnect);
都出错,我很弱的
解决方案 »
- 如何在程序里指定这个位置
- 大家看一下这种效果怎么做出来?
- 急问一个问题~如何在获得DBGRID里所有行的一个记录相加数
- 如何用命令打开指定网页文件("D:\Ks\MyHtml.html")
- 企业的一个进销存管理软件,向另外一个用户发信息时要求在接收方有提示信息。
- ▲▲▲讨论:用netmeeting的做服务的问题!!▲▲▲
- ■■[HOT]: 关于提高CSDN访问速度的若干决议 ■■
- 在table中有cachedupdates可实现用applyupdate最后统一作保存。但好像adotable中没有这项属性了,请问大哥们在ADO中怎样才可以实现相同的功能
- table1中的字段过虑,能否单个字符匹配,像用query中的下划线_?
- 高手帮忙!急!急!急!
- 如何实现两库字段内容修改?
- 求教多层分布的封装问题?
试试。
效果一样的。
我没有试,不过应该行
我的SocketConnection是在运行中产生的,只能动态赋予事件
:~~(
type
TForm1 = class(TForm)
...
private
procedure SocketBeforeConnection(Sender: Tobject);
...
end;procedure TForm1.FormCreate(Sender: TObject);
begin
SocketConnection1.BeforeConnect :=SocketBeforeConnection ;
end;procedure TForm1.SocketBeforeConnection(Sender: Tobject);
begin
Showmessage('begin Connectioning... Destory this dialog.');
end;
我的源代码:unit xxx;
interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, registry, ScktComp,Db, DBClient, MConnect, SConnect;var
SocketConnection:TSocketConnection;function ClientInit():integer;
procedure SocketConnectionBeforeDisconnect(Sender: TObject);implementationfunction ClientInit():integer;
begin
SocketConnection:=TSocketConnection.Create(nil);
SocketConnection.Address:='127.0.0.1';
SocketConnection.Port:=211;
SocketConnection.ServerName:='pServer.RDMain';
SocketConnection.BeforeDisconnect:=SocketConnectionBeforeDisconnect; //这里出错
SocketConnection.Open;
end;procedure SocketConnectionBeforeDisconnect(Sender: TObject);
begin
ShowMessage('disconnect');
end;
type
TForm1=class(tform)
...
private
scSocketConnection: TSocketConnection;
procedure SocketBeforeDisConnection(Sender: TObject);
end;
有些不知什么原因,如果你定义的过程或函数是全局的话,像你那样,就会出错,莫名其妙,
不过你把那些定义放在那应该不会错。