如何通过 VB 获得 google 翻译的结果?
从网上找了一个版本,源代码如下:
VB code:
Option Explicit
'Global DefLang As String
Const WebURL As String = "http://translate.google.com/translate_t"
Const SearchString As String = "result_box dir="
Const EndString As String = "</"
Public Function Translation(InputText As String, LangPair As String) As String
Dim TMPString As String
Dim StartPos As Long
Dim DebString As String
Dim InitString As String
If IsConnected = False Then
MsgBox "You don't have Internet connection!", vbInformation, "Translation"
Translation = ""
Exit Function
End If
'InputText
TMPString = GetHTMLfromURL(WebURL & "?langpair=" & LangPair & "&text=" & InputText)
InitString = SearchString & Chr(34) & "ltr" & Chr(34) & ">"
StartPos = InStr(1, TMPString, InitString, vbTextCompare)
If StartPos = 0 Then
Translation = ""
Exit Function
End If
DebString = Right(TMPString, Len(TMPString) - (StartPos + Len(InitString) - 1))
StartPos = InStr(1, DebString, EndString, vbTextCompare)
Translation = ReplaceHTMLString(Left(DebString, StartPos - 1))
End Function
Public Function ReplaceHT
相关问答:
我用Delphi写了一个DLL, DLL里有MDI的子窗体,DLL初始化时 传递调用者的TApplication给DLL, 在Delphi7中调用已经通过,但是不知道在VB中有无TApplication对应类型, 是否能在VB中调用?
你好,用instance不是就可以了 ......
请教一下:我用vb写了一个调用Illustrator的测试程序,代码很简单:Private Sub Command1_Click()
Dim app As New Illustrator.Application
Dim doc As Illustrator.Document
Dim thislayer As Illustrator.Layer ......
VB如何判断一个控件是否文本框,是否是组合框?
找到答案,结贴
TypeOf
接分.
VB code:
dim o
for each o in controls
debug.print typename(o)
next
典型的倒分贴!
5楼正解!
If ......
我有自动生成序列号的程序,但是怎么跟打包后的安装程序结合在一起,在安装时提示用户输入序列号,正确后再继续安装???
方法1:你可以在运行程序后输入序列号注册,很多软件都是这样的。
方法2:使用Setu ......
VB能否把Control对象转为一个TEXTBOX对象?
VB.NET 有个CType函数,VB没有类似的?
只有转换变量的,似乎没发现有转换控件类型的
Dim txt As Control
Set txt = Text1
&n ......