请把几句VB程序翻译成DLPHI(50分)

F

FYS

Unregistered / Unconfirmed
GUEST, unregistred user!
Dim isSend as Boolean
Set Dsms=CreateObject(“DllSendSms.DllSendSms”)
Dsms.setProxy4("ip",port,"用户名","密码")
Dsms.Connect
isSend=Dsms.SendText "发送者手机号码","接收者手机号码","发送的内容"
if isSend=true then
MsgBox "发送成功"
else
MsgBox "发送失败"
end if
Dsms.Close
 
是这个吗?
uses comobj;

procedure Test;
var
isSend: Boolean;
Dsms: OleVariant;
begin
try
Dsms := CreateOleObject('DllSendSms.DllSendSms');
Dsms.setProxy4('211.101.4.25', '100', '用户名', '密码');
Dsms.Connect;
isSend := Dsms.SendText('发送者手机号码', '接收者手机号码', '发送的内容');
if isSend = true then
ShowMessage('发送成功')
else
ShowMessage('发送失败');

Dsms.Close;
except

end;
end;
 
try
//如上
finally
dsms.Free;
end;



 
呵呵,似乎这样更好。
还有,可以使用OleCheck,还有,那个GetActiveOleObject似乎也可以用一下。
 
运行到Dsms := CreateOleObject('DllSendSms.DllSendSms');
时出错,提示“无效的类别字符串”,是什么原因;
C++是如下表示,可用DELPHI呢,请高手再指教!


Variant v;
try{
v=(Variant)CreateComObject(ProgIDToClassID("DllSendSms.DllSendSms"));
 
照葫芦画瓢嘛。
Dsms := CreateComObject(ProgIDToClassID('DllSendSms.DllSendSms'));
 
Variant v;
try{
v=(Variant)CreateComObject(ProgIDToClassID("DllSendSms.DllSendSms"));
}catch(Exception &e)
{
Application-> ShowException(&e);
ShowMessage(e.Message);
}

WideString a,b,c,d,e,f;
a="";
b="";
c="";
d="";
e ="";
f="";
try{

if( v.OleFunction( "Send",a,b,c,d,e,f))
ShowMessage("OK");
else
ShowMessage("error");
}catch(Exception &e1)
{
Application-> ShowException(&e1);
ShowMessage(e1.Message);
}

还是不行,出错提示为“无效的类型字符串”,请各位大侠参照C++bulid和VB再提建议
 
先用Delphin的引入类库看看是不是Com+程序,再用它的方法。如果不是的话试试静态调用
Dll的方法。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
650
import
I
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
771
DelphiTeacher的专栏
D
顶部