如题,我有多个属性页,当属性窗口显示的时候如何指定某页为初始显示页是用 OCPFIPARAMS 参数的 dispidInitialProperty 域吗,那这个数字又从何而来呢?谢谢!!!!

解决方案 »

  1.   

    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.
      

  2.   

    我不是说有多个 cObjects ,而是说有多个 cPages ,想指定 cPages 中的某个为初始活动页.
    请继续指教!!
      

  3.   

    msdn 上这样说dispIDInitialProperty 
    Property that is highlighted when the dialog box is made visible. 看来应该是这个参数,但这个dispIDInitialProperty 从何而来呢,肯定不是 cPages 的序号,我试过了。
      

  4.   

    你看看这个,使用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.
      

  5.   

    可能还没理解到我的意思,我想用 OleCreatePropertyFrameIndirect 来同时显示多个属性页,就像在桌面上右击一个文件,选择"属性",在弹出的对话筐中就有多个属性页.现在的问题是我想当我的属性对话筐弹出来的时候可以指定其中的某一页,比如第2/第3页为"高亮"显示,而不是第1页.