"Extern" Sendkey/ keybd_Event

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

Damien Sturdy(Posted 2006) [#1]
Hi All,

Well, since I'm new to doing this, i was wondering if you all-knowing users out there could help:

I need to be able to use these functions in BlitzMax- SendKey is most preferable however.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/keybd_event.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/SendInput.asp

I was wondering if any of you could get these working in BlitzMax? I don't know enough about them to do it myself, but I am willing to learn so if someone does it could you explain a bit about what was done?

Call this a hole in my knowledge! :D

Cheers for your help.


kfprimm(Posted 2006) [#2]


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


Damien Sturdy(Posted 2006) [#3]
Thanks for the idea, but this doesn't quite do what I need (I need to send a print_screen so that windows itself thinks I pressed it, and actually does the print screen)

However, thanks for this code. I wasn't aware of this functionality in max. You just made a crapload of my code obsolete!! ;)


kfprimm(Posted 2006) [#4]
Extern "win32"
	Function keybd_event(bVk:Byte,bScan:Byte,dwFlags,dwExtraInfo Ptr)
End Extern


i tried SendInput but because of the way BlitzMax handles Types makes it very hard to use SendInput.


Damien Sturdy(Posted 2006) [#5]
This will do, Thanks very much.

Damn, looked easy too :) Time to test it!


Damien Sturdy(Posted 2006) [#6]
I would like to say Thanks to Khomy Prime. This code got around a huge problem we were having- Thanks!


Who was John Galt?(Posted 2006) [#7]
I have some code in the archives that uses SendInput to simulate mouse clicks. Would be a good basis for someone wanting to add keyboard input.


Damien Sturdy(Posted 2006) [#8]
Yeah, the ability to simulate mouse input is great. The problem I was having was that I was using blitzmax but rendering in another window, without a max window being active, so no Max input (keyboard or mouse) would work. The above worked perfectly. I didnt know about the mouse stuff originally and thought I would be stuck. I never knew how easy it was :)


kfprimm(Posted 2006) [#9]
oops...lol just noticed this...you're welcome Cygnus, anytime.