(long one, sorry)
Hi all,
I moved this from the Users list, since it seems to be a rather
developish problem.
The original question was:
"When I press Win-S, DQSD goes into a loop and all I can do is ! it to
restart. I believe this is because of the fact that I run three
monitors. Anybody else see this?"
It seems nobody had.
Anyways, I found out what it is, and it _is_ in fact related to the
multiple monitors.
The keyboard hooking code has the following snippet:
<snip>
// Find our window
RECT taskBarRect;
GetWindowRect(hBarWnd, &taskBarRect);
// We do all this larking about with the mouse because
// SetForegroundWindow is crippled nowadays, and because the
DQSD edit control
// doesn't actually seem to get a proper caret if you SFW to it
anyway.
ATLTRACE("TaskBarRect: %d,%d,%d,%d\n", taskBarRect.left,
taskBarRect.top, taskBarRect.right, taskBarRect.bottom);
if(taskBarRect.top >= GetSystemMetrics(SM_CYSCREEN)
|| taskBarRect.bottom < 0
|| taskBarRect.left >= GetSystemMetrics(SM_CXSCREEN)
|| taskBarRect.right < 0)
{
// The taskbar is auto-hidden - we need to send more
than one click - one to unhide the tool bar,
// and one to set the focus
SetTimer(hwnd, 0x5744, 50, NULL);
}
</snip>
The problem is in the taskBarRect dimension check. It tries to determine
if the task bar is visible by checking if it's off-screen. But it does
not take virtual desktops/multiple monitors into account, so the timer
re-calls it eternally.
It seems that the multiple monitor support adds four new indices to the
GetSystemMetrics lookup table:
#define SM_XVIRTUALSCREEN 76
#define SM_YVIRTUALSCREEN 77
#define SM_CXVIRTUALSCREEN 78
#define SM_CYVIRTUALSCREEN 79
These define the virtual dimensions of the entire monitor set, as
opposed to the actual primary monitor.
So, by modifying the check to see if the window is hidden to this:
<potentialFix>
if(taskBarRect.top >= GetSystemMetrics(SM_CYVIRTUALSCREEN)
|| taskBarRect.bottom <
GetSystemMetrics(SM_YVIRTUALSCREEN)
|| taskBarRect.left >=
GetSystemMetrics(SM_CXVIRTUALSCREEN)
|| taskBarRect.right <
GetSystemMetrics(SM_XVIRTUALSCREEN))
</potentialFix>
I got the component to understand that the bar is not hidden, but on my
secondary monitor, and everything works fine.
There is a problem with this, though: MSDN claims it's supported on
Win98/ME and Windows 2000 or later, but my Platform SDK headers (which
are somewhat dated), only allows it #if(WINVER >= 0x0500).
Can we build something portable (i.e. including Win95) out of this?
Thanks!
--
Kim Gr�sman
http://www.winwonk.com
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
DQSD-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dqsd-devel