keybd_event to Media Center in windows 7
Hey all, i am trying to send a keybd_event function to a media center window using the code below:
Code:
Private Const VK_DOWN = &H28
Private Const KEYEVENTF_KEYUP = &H2
theForm = FindWindow("eHome Render Window", vbNullString)
theInnerForm = FindWindowEx(theForm, 0&, "eHome FlipEx Host Window", vbNullString)
Call ShowWindow(theForm, SW_SHOWNORMAL)
Call SetForegroundWindow(theForm)
Call SetActiveWindow(theForm)
Call Wait(2)
Call keybd_event(VK_DOWN, 0, 0, 0)
Call keybd_event(VK_DOWN, 0, KEYEVENTF_KEYUP, 0)
The "theForm" has the correct number and it does find the Media Center window and sets it active however it does not seem to do the keybd_event at all within the Media Center form window? I used the "Wait(2)" in order to give it time to set the Media Center form focus since that seem to work best in my test Virtual PC. If i took that out then it ended up not working in my Virtual PC as well.
I got this working (as a test) in a virtual PC environment but once i tried it on a dedicated PC it doesn't seem to want to work? Do i need to add anything in order to make it work in the dedicated Windows 7 PC?
Thanks for your time!
David