Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dialog context help support problem (VC++, MFC)

Posted on 1999-10-07
6
Medium Priority
?
503 Views
Last Modified: 2011-10-03
I have some problem with context help support at dialog boxes. I need 3 kind of help:
1. Whole dialog help (called by pressing F1).
2. Context help for dialog controls in popup windows (called by pressing Help Button in dialog caption, and then hitting some control).
3. Context help for dialog controls in popup windows (called through context menu "What's this?" by right mouse click on the control).
I realised 2 and 3 approachs but i don't know how to catch whole dialog help at F1 key instead calling focused element context help.
Is anybody help me? I will be appreciate any comments.
0
Comment
Question by:turchan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 2107381
Since you didn't specify if you're using any windows framework, I'll assume you're using WinAPI. In your message loop, you probably have something like this:

  while (GetMessage(...))
  {
    if (!IsDialogMessage(...))
    {
      TranslateMessage(...);
      DispatchMessage(...);
    }
  }

The problem is that IsDialogMessage is eating the F1 key. So instead, you should check to see if the F1 key is hit and then do a context search to bring up the appropriate help.
0
 

Author Comment

by:turchan
ID: 2115299
I'm using MFC, not WinAPI, and haven't direct access to message loop.
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 2115585
You should then override PreTranslateMessage(). Take a look at the online help for that function.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:turchan
ID: 2115756
I've already overrided PreTranslateMessage().
I'm trying to disable following dispatching of F1 WM_KEYDOWN message, but despite of this the calling of OnHelpInfo is processed after (or at the same time) the processing of F1 WM_KEYDOWN message.
0
 

Accepted Solution

by:
despote earned 800 total points
ID: 2121360

If you want to trap the F1 message you can do that
//  source scope
#define HK_F1 1 // Your value
WORD hk = 112;  // F1
// Add this line on the message map
   ON_MESSAGE(WM_HOTKEY, OnHotKey)
// and define & implement the OnHotKey function
// as usual
CYourClass::OnHotKey( UINT nID, LPARAM lParam )
{
//  You must be sure than nID is YOUR HotKey
    switch( nID)
    {
         case HK_F1:
    }
}

OnInitDialog()
{
// Add this to your code
   RegisterHotKey( m_hWnd, HK_F1, HIBYTE( hk), LOBYTE( hk))
}
OnClose()
{
   unregisterHotKey( m_hWnd, HK_F1);
}

The other side, is that while your dialog is present, the F1 key will be redirected to your application for all the system. but you can try to catch some killfocus or other api...
0
 

Author Comment

by:turchan
ID: 2123083
Thank you, despote. It works fine.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question