End Google Ads 201810 - BS.net 01 --> I have a program from which I am calling a subordinate form with the axmediaplayer name axWMP.

I want the subordinate form to run from the keyboard but the key strokes are not seen unless I click on the form. It seems that the form loses focus because the keys strokes go to my compiler not the form.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IRmediacontrol
{
public partial class WMP : Form
{
string fname = "";
public WMP(string filename)
{
InitializeComponent();
fname = filename;
}
// At this point if I press a key the keystroke is reported to some other ********
// If I click on this Window the keystroke will be reported here. How can I keep the
// focus on this ********
private void axWMP_KeyPressEvent(object sender, AxWMPLib._WMPOCXEvents_KeyPressEvent e)
{
label1.Text = "key press = " + e.nKeyAscii.ToString();
}

// The program mis behaves before this is involked.
private void button1_Click(object sender, EventArgs e)
{
axWMP.URL = fname;
axWMP.Ctlcontrols.play();
}

}
}


Any help would be appreciated!
modified on Thursday, October 14, 2010 7:16 PM