forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Send key presses without making it focus?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Mon Jan 19, 2009 4:26 am    Post subject: Send key presses without making it focus? Reply with quote

Does anyone know of a way to send key presses to another app window without it becoming the active window, or bringing it forward?

Thanks,
~Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Mon Jan 19, 2009 3:14 pm    Post subject: Reply with quote

Hi Garret.

When I send a string to an application it becoming automaticaly the active window. Sad

The "dialog focus" command not activate our window. We must activate it... "window activate"
Back to top
View user's profile Send private message Visit poster's website
nickos
Valued Newbie


Joined: 17 Mar 2007
Posts: 26

PostPosted: Mon Jan 19, 2009 3:54 pm    Post subject: Reply with quote

Hi Garret

It seems like sendmsg command

http://forum.vdsworld.com/viewtopic.php?p=31784&highlight=#31784
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Jan 19, 2009 7:32 pm    Post subject: Reply with quote

Garrett,
You have finally asked for something that is not possible in Windows. Windows uses the WM_KEYDOWN and WM_KEYUP API messages to tell a application that the users is typing on the keyboard. The issue is that windows only sends these messages to the active window. Windows will not send them to inactive windows. Micro$oft figures a user can only type in 1 window at a time since they only have 2 hands and 1 keyboard unless you know someone with more than that Wink You could switch focus, send the keys, then switch back to your program.

Also what program are you trying to control? Is it something you wrote?

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Jan 20, 2009 10:56 am    Post subject: Reply with quote

dragonsphere wrote:
Garrett,
You have finally asked for something that is not possible in Windows. Windows uses the WM_KEYDOWN and WM_KEYUP API messages to tell a application that the users is typing on the keyboard. The issue is that windows only sends these messages to the active window. Windows will not send them to inactive windows. Micro$oft figures a user can only type in 1 window at a time since they only have 2 hands and 1 keyboard unless you know someone with more than that Wink You could switch focus, send the keys, then switch back to your program.

Also what program are you trying to control? Is it something you wrote?


Yeah, that program I just uploaded on the main vdsworld site. "Media Keyboard 2 Media Player".

What I'm doing is intercepting the media keys, such as play, pause, next, back, stop and sending those keys to some media players that do not have media key support.

I found out though while playing a full screen DX game that when I do that, it draws the darn media player out and takes me out of my game, thus getting me killed in the midst of combat! Sad LOL

I already put a warning that this behavior may happen, so at least anyone who uses it knows it might happen.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Jan 20, 2009 2:14 pm    Post subject: Reply with quote

Garrett,
You may be able to call keybd_event API function to toggle those keyboard keys. SnarlingSheep has an example here on the forum showing how to use this function http://forum.vdsworld.com/viewtopic.php?t=2213&highlight=keybdevent There are other examples as well. This function may just send the keys to the active window though but you could try it.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group