A
ahhjgh
Unregistered / Unconfirmed
GUEST, unregistred user!
我先用VB写了个ACTIVEX DLL,代码如下:
Private Declare Sub Sleep Lib "kernel32"
(ByVal dwMilliseconds As Long)
Public Sub SayString(ByVal astr As String)
SendKeys (astr)
'Sleep 500
'MsgBox (astr)
End Sub
然后通过REGSVR32 注册了该DLL,然后在DELPHI中作如下的调用:
Procedure SayString(aStr:string);
var
objleVariant;
begin
obj:=CreateOLEObject('VBFunc.Says');
obj.SayString(aStr);
end;
DEPHI编译通过,也能运行,但是只能输出第一个字符,我起初以为是字符串参数没有正确地传入到ACTIVEX DLL中,就在DLL中用MSGBOX函数显示传入的字符串,结果传入的字符串是正确的,我又用VB自身调用该ACTIVEX DLL,结果表明DLL没有问题,不知为何用DEPHI调用就只能输出第一个字符,有人知道不?
Private Declare Sub Sleep Lib "kernel32"
(ByVal dwMilliseconds As Long)
Public Sub SayString(ByVal astr As String)
SendKeys (astr)
'Sleep 500
'MsgBox (astr)
End Sub
然后通过REGSVR32 注册了该DLL,然后在DELPHI中作如下的调用:
Procedure SayString(aStr:string);
var
objleVariant;
begin
obj:=CreateOLEObject('VBFunc.Says');
obj.SayString(aStr);
end;
DEPHI编译通过,也能运行,但是只能输出第一个字符,我起初以为是字符串参数没有正确地传入到ACTIVEX DLL中,就在DLL中用MSGBOX函数显示传入的字符串,结果传入的字符串是正确的,我又用VB自身调用该ACTIVEX DLL,结果表明DLL没有问题,不知为何用DEPHI调用就只能输出第一个字符,有人知道不?