views:

301

answers:

2

I was just wondering if there is a way to disable controls such as ctr Left/Right arrows or Alt+left/right arrows in AxWindowsMediaPlayer. I am using it in WindowsFormsHost in my WPF project. I would like to capture these controls and handle them myself. When I use this block, I don't have any way to prevent it by using e.handeld =true or other ways

  void MediaPlayer_KeyDownEvent(object sender, AxWMPLib._WMPOCXEvents_KeyDownEvent e)
        {

        }

Any suggestion how to disable it and continue with my own controls. The important part is it bubbles up somewhere and freezes the GUI if I use such commands, and I don't have any way to capture it to control. It doesn't have any error though.

thanks

A: 

Hi Pardisnoir,

I have one thought to try, but I haven't tested it. Inherit from WindowsFormsHost and override WndProc() method. In this method capture WM_KEYDOWN message, process it, and if it's a key you want to suppress, return 0.

If it doesn't work, you may want to find other way to hook windows procedure.

Hope this helps.

Cheers, Anvaka

Anvaka
Would you please elaborate more on how I can do this?
paradisonoir
A: 

It can be blocked in WindowsFormHost level by controlling keydown.

paradisonoir