From bf8d3026ff71187616d8bd8f9c15cf0dfc5ef4c9 Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 4 Jun 2013 16:30:06 -0400 Subject: [PATCH] Fixed strange bug where music doesn't play when ran as taskbar pinned item. Details: MapVirtualKeyEx(uiScan, MAPVK_VSC_TO_VK, hklQWERTY) returns 0 only when ran pinned, for reasons unknown. Fix: If it returns 0, return original code. May not work for Dvorak. --- src/MainWindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 09499ef..3e90fd2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -216,7 +216,7 @@ WORD MainWindow::GetQWERTYKeyCode(WORD wKeyCode) if (!uiScan) return wKeyCode; UINT uiQWERTY = MapVirtualKeyEx(uiScan, MAPVK_VSC_TO_VK, hklQWERTY); - if (uiScan) + if (uiQWERTY) return (WORD) uiQWERTY; else return wKeyCode; @@ -230,7 +230,7 @@ WORD MainWindow::GetRealKeyCode(WORD wQWERTYCode) if (!uiScan) return wQWERTYCode; UINT uiKeyCode = MapVirtualKey(uiScan, MAPVK_VSC_TO_VK); - if (uiScan) + if (uiKeyCode) return (WORD) uiKeyCode; else return wQWERTYCode; @@ -262,10 +262,10 @@ int GetMIDINote(WPARAM wCode) return note; } -bool MainWindow::Play(WPARAM wCode, LPARAM lParam, bool down) +bool MainWindow::Play(WPARAM wParam, LPARAM lParam, bool down) { int note; - wCode = GetQWERTYKeyCode((WORD) wCode); + WORD wCode = GetQWERTYKeyCode((WORD) wParam); if (wCode > 255 || !keymap[wCode] || (down && (lParam & 0x40000000))) return false;