Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPFKeyboard doesn't work on a 32bit OS #2

Open
brouckaertd opened this issue Jul 3, 2017 · 0 comments
Open

WPFKeyboard doesn't work on a 32bit OS #2

brouckaertd opened this issue Jul 3, 2017 · 0 comments

Comments

@brouckaertd
Copy link

brouckaertd commented Jul 3, 2017

This week I faced an issue on a 32bit OS.

It seemed that the method Fill32 on KLL.cpp is empty.

The code I added for the 32bit OS is:
`
// Fill functions add all the chars based on the VK to an array
void CKLL::Fill32()
{
std::cout << "32bit\n";

//If KbdTables aren't set, just silent return
if(!KbdTables)
	return;

// modifier keys
PMODIFIERS pCharModifiers = KbdTables->pCharModifiers;
PVK_TO_BIT pVkToBit = pCharModifiers->pVkToBit;
while (pVkToBit->Vk)
{
	VK_MODIFIER *modifier = new VK_MODIFIER();
	modifier->VirtualKey = pVkToBit->Vk;
	modifier->ModifierBits = pVkToBit->ModBits;
	m_vkModifiersArray.insert(m_vkModifiersArray.end(), modifier);
	++pVkToBit;
}

// virtual keys to chars with modifieres
PVK_TO_WCHAR_TABLE pVkToWchTbl = KbdTables->pVkToWcharTable;
while (pVkToWchTbl->pVkToWchars)
{
	PVK_TO_WCHARS1 pVkToWch = pVkToWchTbl->pVkToWchars;
	while (pVkToWch->VirtualKey)
	{
		printf("Virtual Key: %d\n", pVkToWch->VirtualKey);
		VK_STRUCT *pVK = new VK_STRUCT();
		pVK->VirtualKey = (int)pVkToWch->VirtualKey;
		pVK->Attributes = pVkToWch->Attributes;

		for (int i = 0; i < pVkToWchTbl->nModifications; ++i)
		{
			//std::wcout << "Char: " << pVkToWch->wch[i] << "\n";
			printf("Char: %d\n", pVkToWch->wch[i]);
			pVK->Characters.insert(pVK->Characters.end(), pVkToWch->wch[i]);
		}
		m_vkarray.insert(m_vkarray.end(), pVK);

		pVkToWch = (PVK_TO_WCHARS1)(((PBYTE)pVkToWch) + pVkToWchTbl->cbSize);
	}
	++pVkToWchTbl;
}

// virtual key scan codes
for (int i = 0; i < KbdTables->bMaxVSCtoVK; i++)
{
	VK_SCANCODE *scanCode = new VK_SCANCODE();
	scanCode->VirtualKey = KbdTables->pusVSCtoVK[i];
	scanCode->ScanCode = i;
	m_vkScanCodesArray.insert(m_vkScanCodesArray.end(), scanCode);
}

PVSC_VK E0ScanCodes = KbdTables->pVSCtoVK_E0;
while (E0ScanCodes->Vsc > 0)
{
	VK_SCANCODE *scanCode = new VK_SCANCODE();
	scanCode->VirtualKey = E0ScanCodes->Vk;
	scanCode->ScanCode = E0ScanCodes->Vsc;
	scanCode->E0Set = true;
	m_vkScanCodesArray.insert(m_vkScanCodesArray.end(), scanCode);
	E0ScanCodes++;
}

PVSC_VK E1ScanCodes = KbdTables->pVSCtoVK_E1;
while (E1ScanCodes->Vsc > 0)
{
	VK_SCANCODE *scanCode = new VK_SCANCODE();
	scanCode->VirtualKey = E1ScanCodes->Vk;
	scanCode->ScanCode = E1ScanCodes->Vsc;
	scanCode->E1Set = true;
	m_vkScanCodesArray.insert(m_vkScanCodesArray.end(), scanCode);
	E1ScanCodes++;
}

// virtual key text
PVSC_LPWSTR keyNames = KbdTables->pKeyNames;
while (keyNames->vsc)
{
	SC_TEXT *scanCodeText = new SC_TEXT();
	scanCodeText->ScanCode = keyNames->vsc;
	scanCodeText->Text = keyNames->pwsz;
	m_scTextArray.insert(m_scTextArray.end(), scanCodeText);
	keyNames++;
}

}
`

The code has been copy pasted from the method Fill64 and changed where needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant