Notifications
Clear all

[Closed] Press Virtual Key(s)?

I found similar code on here, and tried to give it a shot. I want to press the Esc Key, but I tried to send the SpaceBar to the Viewport to see if it would work. No such luck?

Any ideas? Thanks!


(
	local VK_SPACE = 0x20
	local WM_KEYDOWN = 0x0100
	local WM_KEYUP = 0x0101
	local maxHWND = windows.getMaxHWND()
	
	local maxChildren = windows.getChildrenHWND maxHWND
	local view 
	for child in maxChildren do 
	(
		if (child[4] == "D3DWindow") do 
		(
			view = child[1]
		)
	)
	
	UIAccessor.sendMessage view WM_KEYDOWN VK_SPACE 0
	UIAccessor.sendMessage view WM_KEYUP VK_SPACE 0
)