mirror of
https://github.com/quantum5/MusicKeyboard.git
synced 2025-04-24 13:11:58 -04:00
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.
This commit is contained in:
parent
29dd3e7622
commit
bf8d3026ff
|
@ -216,7 +216,7 @@ WORD MainWindow::GetQWERTYKeyCode(WORD wKeyCode)
|
||||||
if (!uiScan)
|
if (!uiScan)
|
||||||
return wKeyCode;
|
return wKeyCode;
|
||||||
UINT uiQWERTY = MapVirtualKeyEx(uiScan, MAPVK_VSC_TO_VK, hklQWERTY);
|
UINT uiQWERTY = MapVirtualKeyEx(uiScan, MAPVK_VSC_TO_VK, hklQWERTY);
|
||||||
if (uiScan)
|
if (uiQWERTY)
|
||||||
return (WORD) uiQWERTY;
|
return (WORD) uiQWERTY;
|
||||||
else
|
else
|
||||||
return wKeyCode;
|
return wKeyCode;
|
||||||
|
@ -230,7 +230,7 @@ WORD MainWindow::GetRealKeyCode(WORD wQWERTYCode)
|
||||||
if (!uiScan)
|
if (!uiScan)
|
||||||
return wQWERTYCode;
|
return wQWERTYCode;
|
||||||
UINT uiKeyCode = MapVirtualKey(uiScan, MAPVK_VSC_TO_VK);
|
UINT uiKeyCode = MapVirtualKey(uiScan, MAPVK_VSC_TO_VK);
|
||||||
if (uiScan)
|
if (uiKeyCode)
|
||||||
return (WORD) uiKeyCode;
|
return (WORD) uiKeyCode;
|
||||||
else
|
else
|
||||||
return wQWERTYCode;
|
return wQWERTYCode;
|
||||||
|
@ -262,10 +262,10 @@ int GetMIDINote(WPARAM wCode)
|
||||||
return note;
|
return note;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::Play(WPARAM wCode, LPARAM lParam, bool down)
|
bool MainWindow::Play(WPARAM wParam, LPARAM lParam, bool down)
|
||||||
{
|
{
|
||||||
int note;
|
int note;
|
||||||
wCode = GetQWERTYKeyCode((WORD) wCode);
|
WORD wCode = GetQWERTYKeyCode((WORD) wParam);
|
||||||
if (wCode > 255 || !keymap[wCode] || (down && (lParam & 0x40000000)))
|
if (wCode > 255 || !keymap[wCode] || (down && (lParam & 0x40000000)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue