ActiveX Focus

Posted on 2006-05-04
Last Modified: 2013-11-20
I am looking for sometype of ActiveX OnFocusChange type of event.  I want to know when my activex is not in focus basically.  how do i do this?

Question by:cophi
    LVL 86

    Accepted Solution

    >>I want to know when my activex is not in focus basically.

    Override 'CWnd::OnKillFocus()' to get notified when your control is loosing the focus, e.g.

    void CMyActiveXWnd::OnKillFocus( CWnd* pNewWnd ) {

      m_bHasFocus = FALSE;

      CWnd::OnKillFocus( pNewWnd );

    for MFC or

    LRESULT CMyActiveXWnd::OnKillFocus( UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) {

      m_bHasFocus = FALSE;

      CComControl::OnKillFocus( nMsg, wParam, lParam, bHandled );

    if you are using ATL base classes


    Author Comment

    That works, but I guess its not exactly what I'm looking for.  When you go to Debug a ActiveX control, inside the debugger you can press ESC and the ActiveX Control will 'Freeze' I thought it was losing focus but apparantly not.  I'm trying to find out when that event occurs.

    Author Comment

    The problem is I have this activeX control on powerpoint and when its not on the slide with the activex control, its in sometype of freeze, or paused state.  I just need to know when this state is happening.
    LVL 86

    Expert Comment

    That probably can't be detected, since PPT just will not call any methods of your control during that phase.

    Author Comment

    I understand that, but some event has to have been called, because on the slide I have a text box with values that are being constantly updated.  When its on the slide with the textbox stuff will be updated, when it moves to the next slide it won't update anymore, when it gets back to the slide with the textbox again, it starts updating again.  Something has to be happening would you agree?

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
    Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now