"Extern" Sendkey/ keybd_Event

BlitzMax Forums/BlitzMax Beginners Area/"Extern" Sendkey/ keybd_Event

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.


Strict

Graphics 800,600

Repeat
	Cls()
	
	If KeyDown(KEY_A)
		EmitEvent CreateEvent(EVENT_KEYDOWN,Null,KEY_G)
	Else
		EmitEvent CreateEvent(EVENT_KEYUP,Null,KEY_G)
	EndIf
	
	If KeyDown(KEY_G)
		DrawText "G is pressed",0,0
	Else
		DrawText "G is released",0,0
	EndIf
	
	If KeyDown(KEY_ESCAPE) End
	Flip()
Forever


here's a simple way to do it, plus it's cross-platform.