OleCreatePropertyFrameIndirect 函数如何指定初始显示页?

wwwcampus 2006-12-29 01:52:46
如题,我有多个属性页,当属性窗口显示的时候如何指定某页为初始显示页

是用 OCPFIPARAMS 参数的 dispidInitialProperty 域吗,那这个数字又从何而来呢?

谢谢!!!!
...全文
242 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwwcampus 2006-12-31
  • 打赏
  • 举报
回复
不会没人用过这个函数吧!!!
wwwcampus 2006-12-29
  • 打赏
  • 举报
回复
可能还没理解到我的意思,我想用 OleCreatePropertyFrameIndirect 来同时显示多个属性页,就像在桌面上右击一个文件,选择"属性",在弹出的对话筐中就有多个属性页.现在的问题是我想当我的属性对话筐弹出来的时候可以指定其中的某一页,比如第2/第3页为"高亮"显示,而不是第1页.
Elysium 2006-12-29
  • 打赏
  • 举报
回复
你看看这个,使用GetObjectArray获取propertysheet的page数组接口

详见MSDN
HOWTO: Gain Access to an ActiveX Control from its Property Page

Sample 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.
wwwcampus 2006-12-29
  • 打赏
  • 举报
回复
msdn 上这样说

dispIDInitialProperty
Property that is highlighted when the dialog box is made visible.

看来应该是这个参数,但这个dispIDInitialProperty 从何而来呢,肯定不是 cPages 的序号,我试过了。
wwwcampus 2006-12-29
  • 打赏
  • 举报
回复
我不是说有多个 cObjects ,而是说有多个 cPages ,想指定 cPages 中的某个为初始活动页.
请继续指教!!
Elysium 2006-12-29
  • 打赏
  • 举报
回复
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.

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧