In a VB6 project I have added reference to the COM dll: c:\windows\system32\locationapi.dll
The following code works perfectly well and the object's methods/properties can be accessed correctly:
Public civicfactory
Set civicfactory = CreateObject("LocationDisp.CivicAddressReportFactory")
However, its events don't work - I cannot catch them. I guess I need to declare the object like this:
Public WithEvents civicfactory As LocationDisp.CivicAddressReportFactory
But this gives me the error "User-defined type not defined" at this line.
Can anyone tell me why it says so while the first code works perfectly well?
And as my purpose is to get event handlers working, can you point out any error or anything missing in my code:
Public civicfactory
Private Sub civicfactory_NewCivicAddressReport(report)
MsgBox "New civic address report arrived"
DisplayCivic (report)
End Sub
Set civicfactory = CreateObject("LocationDisp.CivicAddressReportFactory")
civicfactory.ListenForReports (1000)
Similar code works in VBScript, but I cannot get it working in VB 6 - the event handler never gets called.
Thanks in advance!