How to create a non-interactive window in MFC

Question :

How to create a non-interactive window in MFC,

Answer :

In my application I have a window which I popup with small messages on it (think similar to tooltip). This window uses the layered attributes to draw alpha backgrounds etc.

If I have several of these windows open at once, and I click one with my mouse, when they disappear they cause my application to lose focus (it switches focus to the app behind the current one).

How do I stop any interaction in my window?


After playing with the WM_NCACTIVATE message with no luck, I overrode the WM_SETFOCUS message:

void CMyWindow::OnSetFocus(CWnd* pOldWnd)  {      if (pOldWnd != NULL)      {          pOldWnd->SetFocus();      }  }  

That seems to do the trick. No idea why it works though! Comments welcome on that issue.

Read More  Generic type conversion FROM string

That’s the answer How to create a non-interactive window in MFC, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you