Yielding focus on a window

C C 1 Reputation point
2021-10-01T10:30:32.78+00:00

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,897 questions
C++
C++
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,633 questions
{count} votes

2 answers

Sort by: Most helpful
  1. SM 261 Reputation points
    2021-10-04T14:00:17.95+00:00

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

    -SM

    No comments

  2. Drake_Wu 1 Reputation point
    2021-10-19T07:22:49.423+00:00

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

    No comments