Yielding focus on a window

C C 1 Reputation point

I have the HWND to a window. If it has the focus, I want it to lose the focus. I don't mind where the focus goes. Is there anyway I can do that using win32? Thanks.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
1,979 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
2,750 questions
{count} votes

2 answers

Sort by: Newest
  1. Drake_Wu 1 Reputation point

    Maybe you mean CreateWindowEx(WS_EX_NOACTIVATE, ...) ?

  2. SM 341 Reputation points

    How about getting the next window in z-order by using GetWindow() & GW_HWNDNEXT and call SetFocus() on that?