Пример #1
0
//--------------------------------------------------------------------------
void VeMouse::SetCursor(VeCursor::Data* pkCursor) noexcept
{
	if (pkCursor)
	{
		if (pkCursor != &(m_spDefCursor->m_kData))
		{
			if (!pkCursor->m_kNode.is_attach(m_kCursorList))
			{
				return;
			}
		}
		m_spCurCursor = VeCursor::Cast(pkCursor);
	}
	else
	{
		if (m_pkFocus)
		{
			pkCursor = &(m_spCurCursor->m_kData);
		}
		else
		{
			pkCursor = &(m_spDefCursor->m_kData);
		}
	}

	if (pkCursor && m_bCursorShown && !m_bRelativeMode)
	{
		_ShowCursor(pkCursor);
	}
	else
	{
		_ShowCursor(nullptr);
	}
}
Пример #2
0
LRESULT CALLBACK ScreensaverProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	MATRIX* matrix = GetMatrix(hwndDlg);

	switch(uMsg)
	{
		case WM_NCCREATE:
			_ShowCursor(0);

			matrix = CreateMatrix(hwndDlg, ((CREATESTRUCT*)lParam)->cx, ((CREATESTRUCT*)lParam)->cy);

			if(!matrix)
			{
				MessageBox(hwndDlg, L"Ошибка работы скринсейвера", L"Ошибка", MB_OK | MB_ICONSTOP);
				return 0;
			}

			SetMatrix(hwndDlg, matrix);
			SetTimer(hwndDlg, 0xdeadbeef, ((SPEED_MAX - g_nMatrixSpeed) + SPEED_MIN) * 10, 0);

			return 1;

		case WM_TIMER:
			DecodeMatrix(hwndDlg, matrix);
			break;

		case WM_KEYDOWN:
			if(wParam == VK_ESCAPE)
				SendMessage(hwndDlg, WM_CLOSE, 0, 0);

			break;

		case WM_CLOSE:
			_ShowCursor(1);
			DestroyMatrix(matrix);

			DestroyWindow(hwndDlg);
			PostQuitMessage(0);

			break;

		default:
			return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
	}

	return 0;
}