TScrollBar anomaly


2005-05-05 01:54:18 AM
cppbuilder8
I have a two-threaded application. Worker thread is reading serial port and
sending messages to the main user interface thread. Messages are sent
approx. 60 times a second. Recently we discovered an unexpected problem:
whenever I touch any scrollbar on the user interface, my program loses
messages. Exercising other controls and moving scrollbar programmatically
doesn't cause message loss. It appears that when user controls the
scrollbar, user interface stops responding to messages and doesn't queue
them. It happens even when the scrollbar doesn't have any message handlers
attached to it. I dropped a brand new srollbar on my main form and
reproduced the problem.
I saw similar problem before with the main menu: whenever the main menu is
opened program stops receiving messages (and doesn't queue them either). I
fixed it by changing the menu style to MODELESS at runtime (if you are
interested, the code sample is at the end of this post). However, I don't
know what to do with scrollbars. It appears to be a bug in Borland 6 CPP
Builder.
Has anyone heard about this problem?
Gregory Khrapunovich
Sr. Software Engineer, Applied Science Labs
// Here is how I fixed similar problem with the main menu
HMENU h = MainMenu->Handle;
MENUINFO info;
memset(&info, 0, sizeof(MENUINFO));
info.cbSize = sizeof(MENUINFO);
info.fMask = MIM_STYLE;
bool res = GetMenuInfo(h, &info);
if (res)
{
info.fMask = MIM_STYLE|MIM_APPLYTOSUBMENUS;
info.dwStyle = MNS_MODELESS;
res = SetMenuInfo(h, &info);
}