VB呼叫VB指令碼VBS向Http請求的三種方式

2022-06-10 05:33:07 字數 3654 閱讀 1946

vb**

第一步,建立指令碼物件,讀出 vbstest.txt 檔案

private myscript as

object

private

subform_load()

call

m_initialize

end sub

public

subm_initialize()

dim strscriptfile as

string

dim strscript as

string

dim intfile as

integer

intfile = freefile

\script\vbstest.txt"if

\script\vbstest.txt

") <> ""

then

open strscriptfile

for binary as

#intfile

strscript = input(lof

(intfile), intfile)

close intfile

set myscript = createobject("

scriptcontrol")

myscript.language = "

vbscript"'

myscript.timeout = 1000

myscript.addcode strscript

endif

end sub

第二步  指令碼呼叫的方法

public

function m_fcustom1(byval str呼叫名稱 as

string, byval str伺服器引數 as

string, byref str返回值 as

string) as

boolean

onerror

goto

errtrap

dim stra as

string

str返回值 =myscript.run(str呼叫名稱, str伺服器引數)

'm_fcustom1 = true

exit function

errtrap:

msgbox ("

出錯!" & cstr(err) & "

" & error

(err))

onerror

goto

0end function

第一種 post方式

private

subcommand3_click()

dim stra as

string

call m_fcustom1("

m_post

", "

m_post 11111111

", stra)

msgbox ("

返回值!

" &stra)

end sub

第二種  get 方式

private

subcommand4_click()

dim stra as

string

call m_fcustom1("

m_get

", "

m_get 222222222

", stra)

msgbox ("

返回值!

" &stra)

end sub

第三種  json 方式

private

subcommand1_click()

dim stra as

string

call m_fcustom1("

m_posttest

", "

m_post 介面除錯

", stra)

msgbox ("

返回值!

" &stra)

end sub

vb指令碼** vbstest.txt
function

'jost方式

VB指令碼 BAT指令碼呼叫VB指令碼的方法

毫無疑問地,是懶惰促進或引領著人類科技的發展。工作中使用一些小工具可以大幅提高工作效率,釋放體力勞動,減少手工操作與守候時間,何樂而不為呢?在數通平台軟體的效能或功能穩定性測試過程中,經常需要用一台除錯機 一般是作業系統為 windows 的計算機 通過 securecrt 等遠端登入軟體,連線一台...

VB 呼叫 QuickTestpro 指令碼

摘選自 今天幫乙個加拿大的朋友解決vb呼叫qtp的問題,自己寫了乙個demo 下邊是源 1.新建工程,引入quicktest professional 8.0 object library 2.編寫 如下 private strscriptname as string private strruns...

vb呼叫儲存過程

public sub procexe byval procname as string,byval pch as string dim cn as adodb.connection dim cmd as adodb.command cn.connectionstring cn.open set cm...