locked
PreTranslateMessage is not getting called for OCX control RRS feed

  • Question

  • Hi,

    I have an application to see graph data. Now i'm creating another application in which I show the graph application as OCX control. In My normal application I have a function that to show the graph co-ordinates in tooltip. I have the following code to create a ToolTip

    m_pToolTip = new CCustomToolTipCtrl;

    m_pToolTip->Create(this,TTS_ALWAYSTIP);

    m_pToolTip->SetTipBkColor(RGB(255,255,193));

    m_pToolTip->Activate(TRUE);

    m_pToolTip->SetDelayTime(-1);

    m_pToolTip->AddTool(this, m_sToolText,NULL,0);

    In normal application, PreTranslateMessage is getting called. But in case of OCX control PreTranslateMessage is not getting called. So that the tooltip is not showing the coordinates.

    Please provide your suggestions to solve this

    Friday, December 27, 2013 5:54 AM

Answers

  • Override PreTranslateMessage() in your application and invoke the method of OCX which contains below code

    if(m_pToolTip && m_bShowCursor){
    m_pToolTip->RelayEvent(pMsg);


    Thanks, Renjith V R

    • Proposed as answer by May Wang - MSFT Tuesday, December 31, 2013 9:21 AM
    • Marked as answer by Kafle Tuesday, December 31, 2013 11:40 AM
    Monday, December 30, 2013 5:37 AM

All replies

  • Hi

    According to your issue, PreTranslateMessage is not called in your application with OCX control.

    We know that PreTranslateMessage is designed to allow for translating accelerators and filtering certain messages for tooltips. It is called before the TranslateMessage and DispatchMessage.  But The CView and CPropertyPage classes are not designed to host ActiveX controls. I think you may need to override the PreTranslateMessage function.

    Here is an article: TranslateAccelerator() Not Called for ActiveX Controls for your reference. I think this may help you.

    http://support.microsoft.com/KB/183167

    Best Wishes,

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, December 27, 2013 8:45 AM
  • Hi,

    Thank you for suggestion. And I have the following overridden PreTranslateMessage in my OCX control

    BOOL CMyGraphFrame::PreTranslateMessage(MSG* pMsg)

    {

    if(m_pToolTip && m_bShowCursor){

    m_pToolTip->RelayEvent(pMsg);

    }

    return CDialog::PreTranslateMessage(pMsg);

    }

    I have and application "MyGraph" in this I have MyGraph.exe and MyGraph.ocx.

     In this when I execute the MyGraph.exe this PreTranslateMessage() is getting called. when I use this MyGraph.ocx in my "MyApp" tool then this PreTranslateMessage is not getting called. Do I have to override the PreTranslateMessage() in MyAppView:PreTranslateMessage() ??

    I'm new to ActiveX. Kindly provide suggestions.


    • Edited by Kafle Friday, December 27, 2013 10:17 AM
    Friday, December 27, 2013 10:16 AM
  • Override PreTranslateMessage() in your application and invoke the method of OCX which contains below code

    if(m_pToolTip && m_bShowCursor){
    m_pToolTip->RelayEvent(pMsg);


    Thanks, Renjith V R

    • Proposed as answer by May Wang - MSFT Tuesday, December 31, 2013 9:21 AM
    • Marked as answer by Kafle Tuesday, December 31, 2013 11:40 AM
    Monday, December 30, 2013 5:37 AM
  • Hi Kafle,

    How about your testing according to suggestion from Renjith? Does it work?


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 31, 2013 9:25 AM
  • Thank you Renjith :)
    Tuesday, December 31, 2013 11:41 AM