cObjects Number of object pointers passed in lplpUnk. lplpUnk Array of IUnknown pointers on the objects for which this property sheet is being invoked. The number of elements in the array is specified by cObjects. These pointers are passed to each property page through IPropertyPage::SetObjects.
msdn 上这样说dispIDInitialProperty Property that is highlighted when the dialog box is made visible. 看来应该是这个参数,但这个dispIDInitialProperty 从何而来呢,肯定不是 cPages 的序号,我试过了。
你看看这个,使用GetObjectArray获取propertysheet的page数组接口详见MSDN HOWTO: Gain Access to an ActiveX Control from its Property PageSample Code // The header file of the control-derived class must be included in // the same source file. #include "myctrl.h" CMyCtrl* CMyPropPage::GetControlClass() { CMyCtrl *pMyCtrl; ULONG Ulong; // Get the array of IDispatchs stored in the property page LPDISPATCH FAR *m_lpDispatch = GetObjectArray(&Ulong); // Get the CCmdTarget object associated to any one of the above // array elements pMyCtrl = (CMyCtrl*) CCmdTarget::FromIDispatch(m_lpDispatch[0]); // Cleanup return pMyCtrl; } // If your control has a public member variable, in this case // I am using m_direct_control, then that variable can be // manipulated as follows. void CMyPropPage::OnLButtonDown(UINT nFlags, CPoint point) { // Modify a member variable of Control directly. CMyCtrl *pMyCtrl = GetControlClass(); pMyCtrl->m_direct_control++; // Display the new value of the variable in a message box. char buf[100]; AfxMessageBox (_itoa (pMyCtrl->m_direct_control, buf, 10)); COlePropertyPage::OnLButtonDown(nFlags, point); } In this code, it is assumed that the array of IDispatchs returned from GetObjectArray holds the same IDispatch pointer because in a default ControlWizard-generated application, each property page manipulates a particular ActiveX control.
Number of object pointers passed in lplpUnk. lplpUnk
Array of IUnknown pointers on the objects for which this property sheet is being invoked. The number of elements in the array is specified by cObjects. These pointers are passed to each property page through IPropertyPage::SetObjects.
请继续指教!!
Property that is highlighted when the dialog box is made visible. 看来应该是这个参数,但这个dispIDInitialProperty 从何而来呢,肯定不是 cPages 的序号,我试过了。
HOWTO: Gain Access to an ActiveX Control from its Property PageSample Code // The header file of the control-derived class must be included in
// the same source file.
#include "myctrl.h" CMyCtrl* CMyPropPage::GetControlClass()
{
CMyCtrl *pMyCtrl;
ULONG Ulong; // Get the array of IDispatchs stored in the property page
LPDISPATCH FAR *m_lpDispatch = GetObjectArray(&Ulong); // Get the CCmdTarget object associated to any one of the above
// array elements
pMyCtrl = (CMyCtrl*) CCmdTarget::FromIDispatch(m_lpDispatch[0]); // Cleanup
return pMyCtrl;
} // If your control has a public member variable, in this case
// I am using m_direct_control, then that variable can be
// manipulated as follows. void CMyPropPage::OnLButtonDown(UINT nFlags, CPoint point)
{
// Modify a member variable of Control directly.
CMyCtrl *pMyCtrl = GetControlClass();
pMyCtrl->m_direct_control++; // Display the new value of the variable in a message box.
char buf[100];
AfxMessageBox (_itoa (pMyCtrl->m_direct_control, buf, 10)); COlePropertyPage::OnLButtonDown(nFlags, point);
}
In this code, it is assumed that the array of IDispatchs returned from GetObjectArray holds the same IDispatch pointer because in a default ControlWizard-generated application, each property page manipulates a particular ActiveX control.