Applied patch [ 740012 ] GetKeyState returns 16-Bit value on WindowsNT

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20683 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-05-21 18:43:03 +00:00
parent 6c2298b2db
commit 845cff4d72
2 changed files with 12 additions and 3 deletions

View File

@@ -280,12 +280,18 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0);
// get the current state of SHIFT/CTRL keys // get the current state of SHIFT/CTRL keys
inline bool wxIsShiftDown() inline bool wxIsShiftDown()
{ {
return (::GetKeyState(VK_SHIFT) & 0x100) != 0; // return (::GetKeyState(VK_SHIFT) & 0x100) != 0;
// Returns different negative values on WinME and WinNT,
// so simply test for negative value.
return ::GetKeyState(VK_SHIFT) < 0;
} }
inline bool wxIsCtrlDown() inline bool wxIsCtrlDown()
{ {
return (::GetKeyState(VK_CONTROL) & 0x100) != 0; // return (::GetKeyState(VK_CONTROL) & 0x100) != 0;
// Returns different negative values on WinME and WinNT,
// so simply test for negative value.
return ::GetKeyState(VK_CONTROL) < 0;
} }
// wrapper around GetWindowRect() and GetClientRect() APIs doing error checking // wrapper around GetWindowRect() and GetClientRect() APIs doing error checking

View File

@@ -4151,7 +4151,10 @@ void wxWindowMSW::InitMouseEvent(wxMouseEvent& event,
event.m_leftDown = (flags & MK_LBUTTON) != 0; event.m_leftDown = (flags & MK_LBUTTON) != 0;
event.m_middleDown = (flags & MK_MBUTTON) != 0; event.m_middleDown = (flags & MK_MBUTTON) != 0;
event.m_rightDown = (flags & MK_RBUTTON) != 0; event.m_rightDown = (flags & MK_RBUTTON) != 0;
event.m_altDown = (::GetKeyState(VK_MENU) & 0x80000000) != 0; // event.m_altDown = (::GetKeyState(VK_MENU) & 0x80000000) != 0;
// Returns different negative values on WinME and WinNT,
// so simply test for negative value.
event.m_altDown = ::GetKeyState(VK_MENU) < 0;
event.SetTimestamp(s_currentMsg.time); event.SetTimestamp(s_currentMsg.time);
event.m_eventObject = this; event.m_eventObject = this;