When you use events for asynchronous notifications, most of the work is done by the component author. Setting up a client to receive the events is pretty easy.
Note This topic is part of a series that walks you through creating a sample ActiveX EXE. It begins with the topic Creating an ActiveX EXE Component.
To receive the CoffeeReady event in CoffeeWatch
Option Explicit
Private WithEvents mwcmnTest As CoffeeMonitor
Notice the letter ‘w’ added to the variable mwcmnTest
, to remind the author that this is a WithEvents variable. This is one author’s private convention. The letters ‘cmn’ have been chosen to indicate a variable of type CoffeeMonitor.
Private Sub Form_Load()
Set mwcmnTest = New CoffeeMonitor
End Sub
Private Sub mwcmnTest_CoffeeReady()
MsgBox "COFFEE!"
End Sub
Every ten seconds you’ll get a notification from Coffee. CoffeeWatch is not blocked in the meantime — you can move and resize it, and click the buttons.
This topic is part of a series that walks you through creating a sample ActiveX EXE.
To | See |
Go to the next step | Sharing the CoffeeMonitor |
Start from the beginning | Creating an ActiveX EXE Component |