mirror of
https://github.com/quantum5/MusicKeyboard.git
synced 2025-04-24 13:11:58 -04:00
How can I please you, O GCC?
This commit is contained in:
parent
41feb7fce6
commit
eb5d562ee6
|
@ -59,7 +59,7 @@ BOOL MainWindow::WinRegisterClass(WNDCLASS *pwc)
|
||||||
{
|
{
|
||||||
pwc->style = CS_HREDRAW | CS_VREDRAW;
|
pwc->style = CS_HREDRAW | CS_VREDRAW;
|
||||||
pwc->hbrBackground = (HBRUSH) (COLOR_3DFACE + 1);
|
pwc->hbrBackground = (HBRUSH) (COLOR_3DFACE + 1);
|
||||||
return __super::WinRegisterClass(pwc);
|
return Window::WinRegisterClass(pwc);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT MainWindow::OnCreate()
|
LRESULT MainWindow::OnCreate()
|
||||||
|
@ -258,7 +258,7 @@ int GetMIDINote(WPARAM wCode)
|
||||||
|
|
||||||
bool MainWindow::Play(WPARAM wParam, LPARAM lParam, bool down)
|
bool MainWindow::Play(WPARAM wParam, LPARAM lParam, bool down)
|
||||||
{
|
{
|
||||||
int note, id;
|
int note;
|
||||||
WORD wCode = GetQWERTYKeyCode((WORD) wParam);
|
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;
|
||||||
|
@ -362,13 +362,13 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
delete [] m_keychars;
|
delete [] m_keychars;
|
||||||
m_keychars = new WCHAR[size];
|
m_keychars = new WCHAR[size];
|
||||||
for (i = 0; i < size; ++i) {
|
for (i = 0; i < size; ++i) {
|
||||||
WORD scan = VkKeyScanEx(keychars[i], hklQWERTY);
|
WORD scan = VkKeyScanEx(keychars[i], hklQWERTY), vk, ch;
|
||||||
if (LOBYTE(scan) == -1)
|
if (LOBYTE(scan) == -1)
|
||||||
goto giveup;
|
goto giveup;
|
||||||
WORD vk = GetRealKeyCode(LOBYTE(scan));
|
vk = GetRealKeyCode(LOBYTE(scan));
|
||||||
if (!vk || vk == LOBYTE(scan))
|
if (!vk || vk == LOBYTE(scan))
|
||||||
goto giveup;
|
goto giveup;
|
||||||
WCHAR ch = (WCHAR) MapVirtualKey(vk, MAPVK_VK_TO_CHAR);
|
ch = (WCHAR) MapVirtualKey(vk, MAPVK_VK_TO_CHAR);
|
||||||
if (!ch)
|
if (!ch)
|
||||||
goto giveup;
|
goto giveup;
|
||||||
m_keychars[i] = ch;
|
m_keychars[i] = ch;
|
||||||
|
@ -393,7 +393,7 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) & ~WS_EX_COMPOSITED);
|
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) & ~WS_EX_COMPOSITED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return __super::HandleMessage(uMsg, wParam, lParam);
|
return Window::HandleMessage(uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow *MainWindow::Create(LPCTSTR szTitle)
|
MainWindow *MainWindow::Create(LPCTSTR szTitle)
|
||||||
|
|
|
@ -3,9 +3,14 @@
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifndef max
|
||||||
|
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
|
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL PianoControl::WinRegisterClass(WNDCLASS *pwc)
|
BOOL PianoControl::WinRegisterClass(WNDCLASS *pwc)
|
||||||
{
|
{
|
||||||
return __super::WinRegisterClass(pwc);
|
return Window::WinRegisterClass(pwc);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT PianoControl::OnCreate()
|
LRESULT PianoControl::OnCreate()
|
||||||
|
@ -493,7 +498,7 @@ LRESULT PianoControl::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
SetBackground((HBRUSH) wParam);
|
SetBackground((HBRUSH) wParam);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return __super::HandleMessage(uMsg, wParam, lParam);
|
return Window::HandleMessage(uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
PianoControl *PianoControl::Create(LPCTSTR szTitle, HWND hwParent,
|
PianoControl *PianoControl::Create(LPCTSTR szTitle, HWND hwParent,
|
||||||
|
|
Loading…
Reference in a new issue