为什么我调用ActiveX中的函数老是报错? ( 积分: 100 )

鸢都剑客

Unregistered / Unconfirmed
GUEST, unregistred user!
在ocx是这样定义的:
procedure SendMessage(var MessageID: Integer;
var Command: WideString;
var Content: WideString;
var RoomID: WideString);
dispid 1610809380;
.
procedure TShineSocket.SendMessage(var MessageID: Integer;
var Command: WideString;
var Content: WideString;
var RoomID: WideString);
begin
DefaultInterface.SendMessage(MessageID, Command, Content, RoomID);
end;

他给出的例子是PB的:
socketclient.object.CloseShineSocket( )
socketclient.object.RemoteHost = trim(r_ip)
socketclient.object.RemotePort = 3000
socketclient.object.Connect(socketclient.object.RemoteHost, socketclient.object.RemotePort)
If socketclient.object.State = 7 then
socketclient.object.SendMessage(0,"close","","d5")
Yield ( )
socketclient.object.CloseShineSocket( )
return 1
else
return -1
End If
我用delphi 是这样写的:
shinesck.CloseShineSocket();
shinesck.RemoteHost:='192.168.0.1';
shinesck.RemotePort:=3000;
shinesck.Connect(shinesck.RemoteHost,inttostr(shinesck.RemotePort));
if shinesck.State=7 then
begin
showmessage('s');
shinesck.SendMessage(0,'close','','d5');// 为什么这里提示
//type of actual an format var parameters must
//be identical
//其它的都可以就是这一句有问题
end
else
showmessage(inttostr(shinesck.State));
end;

我的QQ:4854595: e_mail:sxlaq@163.com
我可以把Active传给你。谢谢。分数不够可以再开帖送。。。
 

鸢都剑客

Unregistered / Unconfirmed
GUEST, unregistred user!
在ocx是这样定义的:
procedure SendMessage(var MessageID: Integer;
var Command: WideString;
var Content: WideString;
var RoomID: WideString);
dispid 1610809380;
.
procedure TShineSocket.SendMessage(var MessageID: Integer;
var Command: WideString;
var Content: WideString;
var RoomID: WideString);
begin
DefaultInterface.SendMessage(MessageID, Command, Content, RoomID);
end;

他给出的例子是PB的:
socketclient.object.CloseShineSocket( )
socketclient.object.RemoteHost = trim(r_ip)
socketclient.object.RemotePort = 3000
socketclient.object.Connect(socketclient.object.RemoteHost, socketclient.object.RemotePort)
If socketclient.object.State = 7 then
socketclient.object.SendMessage(0,"close","","d5")
Yield ( )
socketclient.object.CloseShineSocket( )
return 1
else
return -1
End If
我用delphi 是这样写的:
shinesck.CloseShineSocket();
shinesck.RemoteHost:='192.168.0.1';
shinesck.RemotePort:=3000;
shinesck.Connect(shinesck.RemoteHost,inttostr(shinesck.RemotePort));
if shinesck.State=7 then
begin
showmessage('s');
shinesck.SendMessage(0,'close','','d5');// 为什么这里提示
//type of actual an format var parameters must
//be identical
//其它的都可以就是这一句有问题
end
else
showmessage(inttostr(shinesck.State));
end;

我的QQ:4854595: e_mail:sxlaq@163.com
我可以把Active传给你。谢谢。分数不够可以再开帖送。。。
 
Z

zqw0117

Unregistered / Unconfirmed
GUEST, unregistred user!
shinesck.SendMessage(0,'close','','d5');
晕啊,声明中所有参数都是var啊,所以你不需传变量进去,直接给的值都是常量
msgid := 0;
cmd := 'close';
content := '';
roomid := 'd5';
shinesck.SendMessage(msgid,cmd,content,roomid);
 

鸢都剑客

Unregistered / Unconfirmed
GUEST, unregistred user!
接受答案了.
 
Top Bottom