Mordachai
Mordachai

Reputation: 9672

Stop windows toolips from immediately disappearing if they overlap the current mouse position when created

I'm writing a custom tooltip handler - C++ / Windows XP..7.

I'm using the standard tooltip control in manual mode so that I control when to show it and where.

However, when I tell it to appear, if it overlaps the mouse cursor at all, then it immediately disappears (w/o my code asking it to).

This article describes the outline of the idea: http://msdn.microsoft.com/en-us/library/windows/desktop/hh298405%28v=VS.85%29.aspx

And we're essentially doing just that... but if the mouse & the tooltip overlap, the tooltip immediately disappears (flashes for a split second). Incredibly annoying.

Anyone know anything about this?? (i.e. how to stop it from disappearing)

Upvotes: 1

Views: 695

Answers (1)

Raymond Chen
Raymond Chen

Reputation: 45172

If you forget the WS_EX_TRANSPARENT extended style, then mouse events will go to the tooltip, which causes the mouse to no longer be considered over the underlying object, which causes the tooltip to dismiss (since it appears only when the mouse is over the underlying obejct). You want to set the WS_EX_TRANSPARENT extended style to say "Even though the mouse is physically over the tooltip, logically it's over the underlying object." Sample code is available here.

Upvotes: 1

Related Questions