ActiveX DLL中调用主程序中窗体Form1的方法: 在DLL类模块中编写一个全局函数即可:Public Function CallForm(MyForm as Variant,chenjl1031 as boolean) MyForm.visible=chenjl1031 end function 在你的EXE主程序中只要:Call CallForm(Form1,true)即可显示Form1窗体。
Private frmMain As Form Public Property Get SetFrmmain() As Form Set SetFrmmain = frmMain End PropertyPublic Property Let SetFrmmain(ByVal myForm As Form) Set frmMain = myForm End Property Sub main() SetFrmmain = Form1 frmMain.Show End Sub这是一个简单的调用例子 通过这中方法就可以实现
MyForm.visible=chenjl1031
end function 在你的EXE主程序中只要:Call CallForm(Form1,true)即可显示Form1窗体。
Public Property Get SetFrmmain() As Form
Set SetFrmmain = frmMain
End PropertyPublic Property Let SetFrmmain(ByVal myForm As Form)
Set frmMain = myForm
End Property
Sub main()
SetFrmmain = Form1
frmMain.Show
End Sub这是一个简单的调用例子
通过这中方法就可以实现
可以在Exe中建一个辅助类,将该类的实例传递给dll中的窗体,通过调用该对象的方法间接打开exe中的窗体。