Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7073801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:58:24+00:00 2026-05-28T05:58:24+00:00

I am writing a custom tooltip window (let’s call it A). It has to

  • 0

I am writing a custom tooltip window (let’s call it A). It has to be displayed over another window (let’s call it B) and:

  • Do not steal the focus from the B

  • Do not lose its position in z-order to B while user continues input into B

  • A must recieve WM_NCHITTEST messages (i use them to track mouse position over inactive window)

  • When another window is brought over B, it must be brought over A as well; situation where B is covered and not visible, but A is displayed should be averted

I have tried to implement this by using the SetWindowPos function, calling its wrapper (defined in A) from B like this:

    public void SetLocation(Point location, IntPtr UnderHandle)
    {
        SetWindowPos(Handle, HWND_TOPMOST, location.X, location.Y, Width, Height,
                             SetWindowPosFlags.DoNotActivate);

    }

(SetWindowPosFlags from pinvoke.net)

The result satisfies almost all my needs except the lst one.

What have i also tried:

  • HWND_TOP: does not brings window A over active window B; to be more precise: immediately after the call, it does bring window A to foreground, but then B goes to foreground instead; in practice, while B is moved by the title bar and mouse button is pressed, window A is drawn over it – but goes under the moment mouse button is unpressed

  • calling SetWindowPos with UnderHandle as first parameter and Handle as second, in attempt to “bring window B under window A” yields the same result

How should SetWindowPos be usd correctly to achieve desired result – or, alternatively, how can window B’s position in zorder be monitored to force window A into position next to it (from being a foreground window)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:58:24+00:00Added an answer on May 28, 2026 at 5:58 am

    Clearly HWND_TOPMOST is your problem and you certainly must not do that. You could use HWND_TOP, but then the challenge is how to keep window A on top of window B. The way to do that is to make A be owned by B.

    Owned Windows

    An overlapped or pop-up window can be owned by another
    overlapped or pop-up window. Being owned places several constraints on
    a window.

    • An owned window is always above its owner in the z-order.
    • The system automatically destroys an owned window when its owner is
      destroyed.
    • An owned window is hidden when its owner is minimized.

    Only
    an overlapped or pop-up window can be an owner window; a child window
    cannot be an owner window. An application creates an owned window by
    specifying the owner’s window handle as the hwndParent parameter of
    CreateWindowEx when it creates a window with the WS_OVERLAPPED or
    WS_POPUP style. The hwndParent parameter must identify an overlapped
    or pop-up window. If hwndParent identifies a child window, the system
    assigns ownership to the top-level parent window of the child window.
    After creating an owned window, an application cannot transfer
    ownership of the window to another window.

    In fact, as you can see from the first bullet point above, once the ownership is correctly setup, there’s no need for HWND_TOP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a custom validator that checks that at least one field has a
I'm writing a custom TreeView from ScrollableControl. I decided to show tooltips when the
I'm writing a custom tooltip handler - C++ / Windows XP..7. I'm using the
Aside from writing custom code are there any existing features in .NET which allows
When it comes to writing custom MySQL database-driven PHP session management for a VERY
When writing a custom server, what are the best practices or techniques to determine
while writing a custom attribute in C# i was wondering if there are any
When writing a custom channel how can I get the name of the service
I'm writing a custom file selection component. In my UI, first the user clicks
I am writing a custom session handler in PHP and trying to make the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.