Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1092135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:38:14+00:00 2026-05-16T23:38:14+00:00

Hey, I am using C# to try to send key commands to windows media

  • 0

Hey, I am using C# to try to send key commands to windows media center in windows 7.

Currently I can send keys like 4 and see the number 4 appears on the windows media center.

The problem is any key combination like Ctrl+p (to pause a movie) does not seem to have any effects on the media center.

Any help would be greatly appreciated. Here is my code snippet.

    // Get a handle to an application window.
    [DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
    public static extern IntPtr FindWindow(string lpClassName,
    string lpWindowName);

    // Activate an application window.
    [DllImport("USER32.DLL")]
    public static extern bool SetForegroundWindow(IntPtr hWnd);


    String HandleClass = "eHome Render Window";
    String HandleWindow = "Windows Media Center";

    private bool SendKeyCommand()
    {
        bool success = true;
        IntPtr PrgHandle = FindWindow(HandleClass, HandleWindow);
        if (PrgHandle == IntPtr.Zero)
        {
            MessageBox.Show(HandleWindow + " is not running");
            return false;
        }
        SetForegroundWindow(PrgHandle);
        SendKeys.SendWait("^p");
        return success;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:38:15+00:00Added an answer on May 16, 2026 at 11:38 pm

    I was actually able to finally find a solution that worked on this website:

    http://michbex.com/wordpress/?p=3

    I ended up using his VK Class and Remote Sender Class methods to solve this problem. Windows media center must have lower level key hooks and you must implement a keyup/keydown sending solution to exploited the hooks.

    I can finally pause a movie! I will clean up the code and post it later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, im doing a little app for my smart phone, using Windows Mobile 6.
Hey, I am using iBATIS with SQL Server Compact Edition 3.5 and try to
Hey right now I'm using jQuery and I have some global variables to hold
Hey I am developing an desktop application using Spring and Hibernate, and I have
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey, I'm using Levenshteins algorithm to get distance between source and target string. also
Hey there, I've got a block of HTML that I'm going to be using
Hey all. We're sending quite a few emails (around 23k) using IIS6 SMTP service
Hey all. I have a server written in java using the ServerSocket and Socket
Hey gang. I have just written a client and server in C++ using sys/socket.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.