activex创建activex/ocx供 vbs 调用,传递数组

win10一定要创建64位的,32位调用不了

创建ATL控件后,添加简单对象

activex创建activex/ocx供 vbs 调用,传递数组_第1张图片

activex创建activex/ocx供 vbs 调用,传递数组_第2张图片

右键添加属性和方法

activex创建activex/ocx供 vbs 调用,传递数组_第3张图片

'msgbox("Hello,World!")
'我的第一个程序
sub test(i)
    'msgbox("test")
    dim obj1
	'set obj=CreateObject("THISMYOCX.thismyocxCtrl.1") '这个是MFC创建的ocx id写法
	set obj=CreateObject("pidcompute") '这个id是创建的时候写入的,保持一致
	If IsNull(obj) Then
		msgbox("null")
	Else
	    'msgbox("not null")
	End If
    
   'obj.hello
    Dim MyArray(2)
	MyArray(0) = 12345678
	MyArray(1) = -20000001
	MyArray(2) = 208
	'obj.InputArray MyArray
	obj.Compute 10001,10002,10003,10004,10005,10006,10007,10008,MyArray
	Dim result
	result = obj.GetValue 
	msgbox(result)
	
end sub

test "demo"

具体技术实现咨询可私信

你可能感兴趣的:(VBS,activex传递数组)