Creating a static control for another another thread causes 50% CPU on hovering and 'lockup' on clicking ?

Giganews Newsgroups
Subject: Creating a static control for another another thread causes 50% CPU on hovering and 'lockup' on clicking ?
Posted by:  R.Wieser (addre…@not.available)
Date: Thu, 24 Jan 2019

Hello all,

When I hover the mouse over a static control the CPU jumps to 50% (according
to the task manager).  When I click the static(!) control the program seems
to block until I cover the window the control is in.

Not a problem (I rewrote the code so the control is created in the windows
thread), but a request for an explanation.  You see, the thing is that it
happens for a static control - which should not respond to the mouse in any
way ! - but not for a button.

The circumstances are like this:
I've created a thread which in turn registers a class and creates a window
from it.  The program creating the thread receives the handle to the created
window, and uses it to create the above static control and a button.  Both
appear on the window.

All goes fine when click the button and/or send messages to that window.
But as soon as my mouse is ontop of the static control things start to go
wrong.

What might be causing it ?

I've googled the problem and although the consensus is to "never create
cross-thread controls!" I do not see any explanation to the why of it or
what is causing the CPU load / lockup - and I'm curious. :-)

Regards
Rudy Wieser

Replies