var kba = new KBAlertz { "Launch Date" = "October 30th, 2013" }
If you are a Small Business customer, find additional troubleshooting and learning resources at the Support for Small Business site.
SUMMARY
VtsParams A sequence of VTS_ constants that specifies the types of the parameters for the event. The first constant should be of type VTS_I4, for the control ID. These are the same constants that are used in dispatch map entries such as DISP_FUNCTION.
The vtsParams argument is a space-separated list of values from the VTS_ constants. One or more of these values separated by spaces (not commas) specifies the function's parameter list. For example:
VTS_I2 VTS_BOOL specifies a list containing a short integer followed by a BOOL.
If pfnHandler has some additional parameters besides the UINT of the control ID, then each VTS_ constant for vtsParams after VTS_I4 must match the data types of these additional parameters of pfnHandler.
To better illustrate the usage of the ON_EVENT_RANGE macro, a simple sample is shown below.
MORE INFORMATION
VTS_I4 VTS_I2
For instance, the function prototype for pfnHandler is below:
BOOL CTestDlg::TestOnProblem(UINT CtrlID, short Param)
{
TRACE("control id = %u, Second parameter = %d\n", CtrlID, Param);
return TRUE; // returns TRUE to indicate the event was handled;
}
BEGIN_EVENTSINK_MAP(CTestDlg, CDialog)
//{{AFX_EVENTSINK_MAP(CTestDlg)
//}}AFX_EVENTSINK_MAP
ON_EVENT_RANGE(
CTestDlg, // Class to which this event sink map belongs.
IDC_FIRSTCTRL, // ID of the first control in the range.
IDC_LASTCTRL, // ID of the last control in the range.
1, // Dispatch ID of event fired by the control.
TestOnProblem, // Function for handling events.
VTS_I4 VTS_I2) // VTS_I4 and VTS_I2 are the first and second
// parameters of TestOnProblem() function.
END_EVENTSINK_MAP()
Also, make sure the controls whose events are being handled have IDs within the contiguous range of IDs listed in ON_EVENT_RANGE. Check the Ids by clicking View on the Resource Symbols toolbar in Visual C++ 5.0. Note that the IDs of the controls may be different than expected, depending on the order in which they were created on the dialog box template.
Although one can't create an ON_EVENT_RANGE handler using ClassWizard, it is possible to create an ON_EVENT handler using ClassWizard. Please be aware that in creating an ON_EVENT handler using ClassWizard, the return type of the handler created may be void. This is a bug in ClassWizard. The documentation for both ON_EVENT and ON_EVENT_RANGE is still correct when it says "This function should have a BOOL return type." Returning void usually works correctly, however, so this is not a big problem.
(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Yeong- Kah Tam, Microsoft Corporation.
1037



被折叠的 条评论
为什么被折叠?



