1

Whenever my AxWindowsMediaPlayer1 is on fullscreen and I click on it, it basically either stops my player or starts playing again from the moment it was paused. Is there anyway to disable touch/click on my player forever?

I should probably mention that I've already added this:

AxWindowsMediaPlayer1.enableContextMenu = False
AxWindowsMediaPlayer1.Ctlenabled = False

The first one disables the option menu which appears when you right click on the media player and the second one disables main functions such as double clicking it to go fullscreen but none of those two solves my little problem.


EDIT: I still haven't find a way to solve this pfff. If anyone can help me, then feel free and post about it. Is there maybe any possible way to disable the play-pause button function forever?

user3288047
  • 25
  • 2
  • 7

1 Answers1

0
AddHandler mpOCX.MouseMoveEvent, AddressOf doMouseMove

Private Sub doMouseMove(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_MouseMoveEvent)
    OnMouseMove(New MouseEventArgs(MouseButtons.None, 0, e.fX, e.fY, 0))
End Sub

' ... not sure if these will have some effect

mpOCX.uiMode = "none"
mpOCX.Ctrlenabled = False
mpOCX.enableContextMenu = False
mpOCX.stretchToFit = True ' bonus

' ... to change the mouse cursor, override OnMouseEnter in your mpOCX object, which inherits from AxWindowsMediaPlayer:

Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
    ' ... again, this goes in the 
    Cursor = Cursors.Arrow
    MyBase.OnMouseEnter(e)
End Sub

' ... also, to short-circuit keyboard messages, you will have to Override PreProcessMessage in the mpOCX class, so might as well make one.
' ... these fire for keydown for WMP shortcut keys, keyup for all regular keys, but they don't fire keyup for WMP shortcut keys. this WILL disable all navigation via keyboard in WMP, so you can't press ctrl+O for example.

Public Overrides Function PreProcessMessage(ByRef m As Message) As Boolean
    Return True
    'Return MyBase.PreProcessMessage(m) ' do not uncomment
End Function

' ... other methods you could Override instead are ProcessCmdKey, ProcessDialogChar, ProcessDialogKey, ProcessKeyMessage, ProcessKeyEventArgs, ProcessKeyMessage, ProcessKeyPreview, ProcessMnemonic - but it's like playing whack-a-mole...

Oh sorry, I misread your question, lol ;p In fact, I can't even remember if this disables mouse clicks or not.. it looks like it does, its in my WMP code, but I'd have to fix some lines and rebuild ;p so I can't test at the moment, but I hope it helps.

Actually, there is a MouseDownEvent(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_MouseDownEvent) which should allow you to handle that in the same manner. I'm not sure what my mousemove code is for, but it does something, I can guarantee that. Probably just fires events to move the cursor, since the messages are being sent to the control.

Lynn Crumbling
  • 12,985
  • 8
  • 57
  • 95
porkchop
  • 401
  • 3
  • 8
  • Hmm yeah you kinda confused me with your previous answer indeed. Had no errors adding your code but it did bother me that it had no effects lol. About the MouseDownEvent I also added it but not really sure what else to add to make it work.. Mouse down event is the movement event right? Also I found this little trick which helps me achieve my purpose but it has some side effects. Dunno maybe you can solve this out. After adding this code, my form stacks on my windows with my taskbar beneath, without letting me make it full screen or hide the taskbar completely. http://pastebin.com/2zp5r1mp – user3288047 May 29 '14 at 22:16
  • Had no more letters left on my previous answer. So this new method I posted basically makes the form full screen and disables actions but it somehow makes the task bar stuck on top of it.. Should I somehow try to hide the taskbar only and it will work properly? – user3288047 May 29 '14 at 22:21
  • Here's a pic of my desktop after hiding the cursor http://s30.postimg.org/mu4g1qp4h/mydesktop.png – user3288047 May 29 '14 at 22:53
  • yea, you need a fullscreen function like: http://stackoverflow.com/questions/23843424/programming-full-screen-normal-screen-size-button-in-vb you will also need `WndProc` Override to handle `WM_SYSCOMMAND`, `SC_SCREENSAVE` and `SC_MONITORPOWER` messages, to prevent those. anyways, it's looking like i won't be able to fix my WMP class for a few days. i changed all the interfaces and types so i could work on just DirectShowAPI, while building a 'media library/db cache' for it. – porkchop May 29 '14 at 23:25
  • @user3288047 well, finally got media player working again, it seems the `.Ctlenabled` property will disable mouse clicks. you have to add that property **after** the control is created, or `Override Sub OnCreateControl` in the `AxWindowsMediaPlayer` derived class (preferred method). the mouse events i described will allow you to subscribe to the **AX** control's mouse events in the parent panel. just declare the control `WithEvents` (easier), or attach handlers. – porkchop Jun 03 '14 at 01:21