Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

DLL/API that allows you to output "from the keyboard"?

Does anyone here know of a DLL with a command or a Windows API that lets you output text to whatever the active program is, giving the illusion that the text is coming from the keyboard. I'm trying to write a program (in BBC Basic for Windows) that outputs the currently playing song from winamp to any program :)
0
QuantumJimbo
Asked:
QuantumJimbo
2 Solutions
 
AlexFMCommented:
See SendInput and keybd_event API.
0
 
enkimuteCommented:
I would sujest using the clipboard instead ..
0
 
plqCommented:
Get the HWND of the running program, using findwindow or getmodulehandle etc etc.

Then send it WM_KEYDOWN and WM_KEYUP messages using sendmessage or postmessage.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputmessages/wm_keyup.asp
0
 
enkimuteCommented:
hmm that's not gonna do it for all apps .. some respond on WM_CHAR ..
0
 
QuantumJimboAuthor Commented:
Thanks folks!
keybd_event worked, but the website plq gave told me the syntax on another page.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now