Home > Software engineering >  Nested OCX, VB6
Nested OCX, VB6

Time:09-26

OCX set a do-it-yourself OCX, as a result, calls the nested running normally, but exit the program, warning: memory cannot be written, it makes me very confused,

Then repeated examination, didn't find what I know,

So very simplified, do a insideOcx, a outSideOcx call, and call it with the HTA outSideOcx

InsideOcx inside put a Winsock control, a timer control, code is as follows:

 Public ServerIP As String 
Public ServerPort As Integer

Private Sub UserControl_Initialize ()
'
End Sub

Public Sub ConnectServer ()
Winsock1. RemoteHost ServerIP=
Winsock1. RemotePort=ServerPort
Winsock1. Connect
End Sub


OutsideOcx was called, the code is as follows:

 Public Property Let ServerIP (ByVal sIP As String) 
NestInside1. ServerIP=sIP
End Property

Public Property Let ServerPort (ByVal iPort As Integer)
NestInside1. ServerPort=iPort
End Property


Public Sub Con ()
NestInside1. ConnectServer
End Sub


The HTA, suffix to the HTA is HTML, every object to write outsideOcx, do not need to write any code,

Open the HTA, close, can appear memory cannot be written warning,

CodePudding user response:

Don't need to run ocx code inside, what all don't need to, as long as open the HTA load outsideOcx, closing is certainly an error,

But not nested, only load insideOcx, closed won't complain,

Whether loading insideOcx or outsideOcx, there is no problem using the JS code to execute the ocx, is closing the hta report errors,

CodePudding user response:

Yourself *. The use of OCX and other OCX method is the same, you just registered on your OCX is ok,