CPropertySheet 和 CPropertyPage (帮助文档的调用问题)

在属性表中使用帮助:CPropertySheet 和 CPropertyPage CPropertySheet 类的对象表示属性表,也称为选项卡对话框。每个属性表由一个 CPropertySheet 对象和一个以上的 CPropertyPage 对象组成。属性表被框架显示为带有一组选项卡索引的窗口。用户使用这组索引选择当前页和当前选定页的某区域。 CPropertySheet 中的帮助只受 F1 键和“帮助”按钮的支持。默认情况下“帮助”按钮出现在应用程序的框架中。用户不需要进行干预。在用户为属性表中的各页添加帮助信息时,单击“帮助”按钮,帮助机制就会自动显示该页的帮助。 若要从属性表中移除“帮助”按钮,请修改属性表和其中的所有页,

如下所示: mySheet.m_psh.dwFlags &= ~PSH_HASHELP;

 page1.m_psp.dwFlags &= ~PSP_HASHELP;

page2.m_psp.dwFlags &= ~PSP_HASHELP;

mySheet.AddPage( &page1 );

 mySheet.AddPage( &page2 );

mySheet.DoModal();

m_psh 变量为 PROPSHEETHEADER 类型。

m_psp 变量为 PROPSHEETPAGE 类型。如果清除了所有的 HASHELP 标志(PSH_HASHELP 表示属性表对象)

 

上面是隐藏帮助按钮的操作代码;

如果不隐藏如何调用自己的帮助文档;

解决方法如下:

WM_HELP Message

Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window.

Parameters

wParam
Must be zero.
lphi

The address of a HELPINFO structure that contains information about the menu item, control, dialog box, or window for which Help is requested.

Return Value

Returns TRUE.

 

//===假如你的项目是基于对话框的,那种**App类中,增加virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);重载这个虚函数;

代码如下:

void CMyApp::WinHelp(DWORD dwData,UINT nCmd)
{
 CString str_path = _T("");
 GetModuleFileName(NULL,str_path.GetBufferLength(MAX_PATH+1),MAX_PATH);
 str_path.ReleaseBuffer();
 
 int i_pos = str_path.ReleaseFind('//');
 str_path = str_path.Left(i_pos);
 str_path = str_path + _T("//Help//Manual.chm");
 ShellExecute(NULL,"open",str_path,NULL,NULL);
 //CMyApp::WinHelp();
}

这样就可以调用自己的帮助文档了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值