CreateObjectWithEvents

This function creates a reference to an Automation object that has events.

Syntax

CreateObjectWithEvents(object, prefix)

Parameters

object
String that contains the ProgID of the object to create.
prefix
String that specifies the name of the object for events.

Return Values

Returns a reference to an Automation object that has events.

Remarks

Use CreateObjectWithEvents to create non-visible ActiveX controls at run time. You cannot use CreateObjectWithEvents to create graphical objects such as a TreeView control or a ListView control. The following table lists the ProgID values for the ActiveX controls with events.

Control
ProgID
Microsoft CE Comm control 6.0 CEcomm.comm
Microsoft CE WinSock control 6.0 WinSock.winSock

The following code example shows how to use the prefix string to define object events.

Dim C1 as CECOMMCtl.Comm
Set C1 = CreateObjectWithEvents(“CECOMM.Comm”, “C1_”)
Public Sub C1_OnComm(…)
  […code for the OnComm event…]
End Sub