CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Aug 2008
    Posts
    114

    Question 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
    Last edited by StealthRT; December 29th, 2010 at 10:27 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured