Default Handling of VBX Events

ID: Q119063

1.00 1.50 WINDOWS kbprg

The information in this article applies to:

   The Microsoft Foundation Classes (MFC) included with:
    - Microsoft Visual C++ for Windows, versions 1.0 and 1.5

SUMMARY

The VBX emulation layer provided by MFC will not send an event notification unless the event has been registered. However, it might be desirable to provide handling for non-registered VBX events. This could be used for providing diagnostic information for all events that a VBX dispatches which aren't handled by an application.

MORE INFORMATION

When a VBX event occurs MFC will search through all registered events (registered using AfxRegisterVBEvent) to find the notification code for the particular event which occurred. If the event has not been registered then MFC will look for a default event. This event is called: "Default VBEvent". If you register this event then the VBX emulation layer will send a WM_VBXEVENT message with the registered notification code of the default event.

For example if you were to register this event as follows:

UINT VBN_DEFAULTEVENT = AfxRegisterVBEvent("Default VBEvent");

Then the VBX emulation layer will send a WM_VBXEVENT message with the VBN_DEFAULTEVENT notification code. You can still unpack the event information to find what the "true" event was that generated this message. The nEventIndex member of the AFX_VBXEVENTPARAMS structure will have the id of the "true" event that caused the notification to be sent. See MFC TechNotes 24 and 27 for more details on the WM_VBXEVENT message and the AFX_VBXEVENTPARAMS structure.

REFERENCES

MFC TechNote #24 describes private MFC messages including the WM_VBXEVENT message.

MFC TechNote #27 describes MFC's emulation support for VBX controls including how events are packed and sent as parameters.

Additional reference words: 1.00 1.50 2.00 2.50 kbinf ctl vb KBCategory: kbprg KBSubcategory: MfcVBX Keywords : kb16bitonly

Last Reviewed: July 23, 1997