lupin218
lupin218

Reputation: 23

How to catch EM_SHOWBALLOONTIP CEdit Message?

I'm trying to catch CEdit EM_SHOWBALLOONTIP message within PreTranslateMessage function. Can somebody tell me how to do this ? thank you

BOOL CTestDlg::PreTranslateMessage(MSG* pMsg)
{
    if (pMsg->hwnd == m_edit1.GetSafeHwnd())
    {
        if (pMsg->message == EM_HIDEBALLOONTIP)
        {
        }
        
    }
    return CDialogEx::PreTranslateMessage(pMsg);
}

Upvotes: 2

Views: 159

Answers (2)

ko-barry
ko-barry

Reputation: 11

You can subclass CEdit as MyEdit to suppress tooltips.

Declare

afx_msg LRESULT OnShowTip(WPARAM wParam, LPARAM lParam);

Implement

BEGIN_MESSAGE_MAP(MyEdit, CEdit)
    ON_MESSAGE(EM_SHOWBALLOONTIP, OnShowTip)
END_MESSAGE_MAP()

LRESULT MyEdit::OnShowTip(WPARAM wParam, LPARAM lParam)
{
    // Suppress the tooltip by returning TRUE
    return TRUE;
}

Upvotes: 0

IInspectable
IInspectable

Reputation: 51395

PreTranslateMessage is nested inside the message loop. Consequently, it is called for queued messages only. EM_SHOWBALLOONTIP is a sent message, and never winds up in the message queue.

In other words: You cannot observe EM_SHOWBALLOONTIP in a PreTranslateMessage implementation.

Upvotes: 2

Related Questions