static const int  MAX_SOLO_KEY_DOWN_TC = 300;


LRESULT CALLBACK  WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
	switch( msg )
	{
		case WM_SYSKEYUP:
		{
			word uScan = HIWORD(lParam);
			uScan &= 0x1FF;

			if( uScan == 56 && ( GetTickCount() - dwLAltKeyDownTC < MAX_SOLO_KEY_DOWN_TC )  )// && bLAltSolo )
			{
				KbdString( LAlt_KEY_ANSI_STR );
			}

			if( uScan == 312 && ( GetTickCount() - dwRAltKeyDownTC < MAX_SOLO_KEY_DOWN_TC )  )// && bRAltSolo )
			{
				KbdString( RAlt_KEY_ANSI_STR );
			}
		
			if( wParam == 18 && !(GetKeyState(VK_MENU)&BIT_15) )
			{
				bAltPressed = false;
			}
		}
		break;


		case WM_SYSKEYDOWN:
		{
			word uScan = HIWORD(lParam);
			uScan &= 0x1FF;

			bLShiftSolo = false;
			bRShiftSolo = false;
			bRCtrlSolo = false;
			bLCtrlSolo = false;
			
			if( wParam == 18 )
			{ // LALT || RALT
				if( !bShiftPressed && !bCtrlPressed && !bAltPressed )
				{
					if( uScan == 56 )
					{
						bLAltSolo = true;
						dwLAltKeyDownTC = GetTickCount();
					}
					else
					{
						bRAltSolo = true;
						dwRAltKeyDownTC = GetTickCount();
					}
				}
				bAltPressed = true;
			}
			else
			{
				bLAltSolo = false;
				bRAltSolo = false;
			}
			
			if( uScan == 68 ){ KbdString( F10_KEY_ANSI_STR ); }
		}
		break;
	}

	return 0;
}
