Option Strict Off
Option Explicit On
Module MdEnviaTeclas
	
	Private Const KEYEVENTF_KEYUP As Integer = &H2
	Private Const INPUT_KEYBOARD As Short = 1
	
	Private Structure KEYBDINPUT
		Dim wVk As Short
		Dim wScan As Short
		Dim dwFlags As Integer
		Dim time As Integer
		Dim dwExtraInfo As Integer
	End Structure
	
	Private Structure GENERALINPUT
		Dim dwType As Integer
		<VBFixedArray(23)> Dim xi() As Byte
		
		'UPGRADE_TODO: "Initialize" must be called to initialize instances of this structure. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B4BFF9E0-8631-45CF-910E-62AB3970F27B"'
		Public Sub Initialize()
			ReDim xi(23)
		End Sub
	End Structure
	
	'UPGRADE_WARNING: Structure GENERALINPUT may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
	Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Integer, ByRef pInputs As GENERALINPUT, ByVal cbSize As Integer) As Integer
	'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
	'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
	Private Declare Sub CopyMemory Lib "kernel32"  Alias "RtlMoveMemory"(ByRef pDst As Any, ByRef pSrc As Any, ByVal ByteLen As Integer)
	
	Public Function SendKeysA(ByVal vKey As Short, Optional ByRef booDown As Boolean = False) As Object
		'UPGRADE_WARNING: Array GInput may need to have individual elements initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="B97B714D-9338-48AC-B03F-345B617E2B02"'
		Dim GInput(0) As GENERALINPUT
		Dim KInput As KEYBDINPUT
		
		KInput.wVk = vKey
		If Not booDown Then
			KInput.dwFlags = KEYEVENTF_KEYUP
		End If
		GInput(0).dwType = INPUT_KEYBOARD
		'UPGRADE_WARNING: Couldn't resolve default property of object KInput. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		Call CopyMemory(GInput(0).xi(0), KInput, Len(KInput))
		Call SendInput(1, GInput(0), Len(GInput(0)))
	End Function
End Module