Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

context sensitive help for custom windows in MFC or ATL

Status
Not open for further replies.

teriviret

Programmer
Dec 12, 2003
288
US
I'm interested in implementing context sensitive help for a custom made window (an ATL ActiveX control hosted in an MFC CView, really) that I'm making. So if a user looks at some part of my window and says, "What the heck is that?", I want to give them the ability to click on it and get more information in a pop-up window or WinHelp/HtmlHelp window.

I thought context sensitive help support (i.e. the "Shift+F1" accelerator or the "question mark with arrow" toolbar button) would be the perfect thing. It sounds exactly like what I want. I want to be able to delegate to either my CView window or ActiveX control whenever "help mode" is entered and the user clicks the mouse in my window's area.

My problem is I can't figure out how "help mode" actually works. For example, how does a view window (MFC class "CView") get notified whenever "help mode" is entered? What is the right way to track the mouse position and provide the framework with a command ID to use when invoking WinHelp or HtmlHelp?

I tried overriding IOleWindow::ContextSensitiveHelp() in my ActiveX control, but this never ends up getting called. I figured the framework was just not reaching the control, so I started looking at the CView and CFrameWnd objects in the application for places to plug in my code. I see there is CFrameWnd::OnContextHelp() and CWnd::GetWindowContextHelpID(), but it seems to me these only tell me "help mode" is entered, and select an ID for an entire window, but don't allow me any control or notification over mouse position tracking.

What if I have windowless elements in the window to which I want to assign different help IDs? I was expecting to find a windows message or method like OnHelpHitTest that would pass in a mouse position and allow me to return the corresponding help ID. Does this exist somewhere or am I going about this whole thing the wrong way?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top