Hi Rūdolfs, On 05.11.2017 17:05, Rūdolfs Bundulis wrote: > Hi, > > I'm having issues adding an active event listener via the XPCOM api. > I've created a class from the template in the documentation: > [...] > > and put the NS_IMPL_ISUPPORTS1(CVirtualBoxEventListener, > IEventListener) macro in my cpp file. But the HandleEvent method is > never called. I register the listener by getting the event source from > the console object like this (sorry for all the macros, that I have > for exception handling): > [...] > > No events are triggered but on shutdown the VBOX XPCOM runtime > actually releases the object so it seems that it is aware of it. With > active mode, is there anything else I should be calling? I looked up > some python examples which do call a python VBOX API method > waitForEvents. Is there something similar in the C++ XPCOM API?
Most python examples I'm aware of use passive event delivery, so aren't relevant when you've decided to go for active event delivery. Also the VirtualBox GUI is not a good example any more since it's been converted to passive event delivery a while ago (IIRC 5.0 still had the active variant), so let's go for one of the most simple places I could find, VBoxSDL: https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp Still it uses templates (ListenerImpl<>) and lots of magic wrappers to abstract over the differences between COM and XPCOM (which lots of people would like to use but so far we didn't manage to include in a sensible way in the SDK package), which needs way more apologies than your couple of comparably harmless macros for error checking. The ListenerImpl<> template is defined in https://www.virtualbox.org/browser/vbox/trunk/include/VBox/com/listeners.h and the rest (if you really need to know) in the same directory. The C bindings example would have both active and passive event delivery as compile-time option, but that's too low level I assume... Hope this gives enough inspiration to identify the problem - your code didn't look far off the track. Klaus _______________________________________________ vbox-dev mailing list vbox-dev@virtualbox.org https://www.virtualbox.org/mailman/listinfo/vbox-dev