|
-
March 29th, 2009, 04:25 PM
#1
use sendmessage api as sendkey to inactive window
I need badly to send keystrokes to Windows Media Encoder 9, when it is minimized (meaning the window is not active).
WME is a great program for streaming to a Windows Media Server, but it is a bit unstable for continuous encoding, that is it stops encoding due to some strange errors. Its not our subject here to analyze them.
The fact is that when pressing the START ENCODING button (hotkey: Ctrl+Shift+E), the encoder starts encoding again without a problem. We cant afford to pay a human to watch the streaming process all the time if something happends.
I made a simple utility which it sends Ctrl+ShifT+E every one minute, even the encoder encodes OK (the WME has no problem if it accepts the hotkey even when is broadcasting). So we are ok if the process stops: in a minute the utility sends the right hotkey and the process starts ok.
This works, but the computer has to do some more stuff, meaning I cant have the WME window open and active all the time.
I read about SendMessage, and I've tried ANY example I've found on the internet
h = FindWindow(vbNullString, "LIVE - Windows Media Encoder")
SendMessage h, WM_KeyDown, VK_Control, 0&
SendMessage h, WM_KeyDown, VK_Shift, 0&
SendMessage h, WM_KeyDown, VK_E, 0&
Sleep 300
SendMessage h, WM_KeyUp, VK_E, 0&
SendMessage h, WM_KeyUp, VK_Shift, 0&
SendMessage h, WM_KeyUp, VK_Control, 0&
The code seems OK, but .. it doesnt work.
I also tried an example I've found of searching all the child controls in WME's parent window. The loop returns only the scroll bar! So I cant find the button "Start Encoding" in order to send a button click on that control.
Anyone can help?
- Better live in the digital world -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|