Results 1 to 10 of 10

Thread: How to get hWnd from an MediaPlayer OCX

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Austria
    Posts
    3

    How to get hWnd from an MediaPlayer OCX

    Hi there,

    For some reason I need to know the hWnd of a MediaPlayer Control which is placed on my form.

    Every other control offers a hWnd as a property. But not bloody MediaPlayer 7.01
    Strange thing: "ActiveMovie" Control (which comes to provide compatibility) offers hWnd. But I can't use ActiveMove cause it does not support some other needed features of MediaPlayer.

    Any ideas ?

    Thanks,
    Hias


  2. #2
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    The Netherlands
    Posts
    403
    maybe I'm able to help you if you say why you need the hWnd. We can figure out then what other possibilities you have. I've tried with the function windowfrompoint to receive his hwnd, that didn't work out. By using Spy++ you can get the hWnd of an object named 'VBFocus'. When I delete the mediaplayercontrol, the VBFocus object isn't there anymore, so I suppose that the mediaplayer is called 'VBFocus'.
    Now, you can try to use EnumChildWindows and pass it your window's hwnd. You ask for every hwnd you get with the callbackfuntion his classname. If it is VBFocus, then that should be the hwnd of the mediaplayercontrol.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Austria
    Posts
    3
    Well, I need the hWnd for capturing media-player's window content.

    The good thing is: now I know how to retrieve the hWnd. Its as simple:
    Dim hWnd as Long
    hWnd = MediaPlayer1.ActiveMovie.hWnd

    ActiveMovie is a pseudo object within mediaplayer for backward compatibility.

    The bad thing is: capturing media-player's window content does not work.
    I tried out several methods - all same result: wenever a video is loaded, running or paused: capture content is black

    Do you know this problem ?
    Hias

  4. #4
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    The Netherlands
    Posts
    403
    With capturing, do you mean copying the hDC from the control/making a screenshot with VB? (I'm dutch, no good english )
    There are 10 types of people, those who understand binary and those who don't

    http://merlijn.beyonix.net

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Austria
    Posts
    3
    Hi,

    Exactly, I wanna get snapshots of the video which is currently played by mediaplayer.

    The "classic" way (BitBlt'ing from the Media-Players hDC) does not work correct:
    If Mediaplayer is just startet, without playing a video, it is showing its microsoft logo. In this case BitBlt is working. But if I start a video (AVI or MPG) BitBlt does not work any longer - I get just grey bitmaps.

    I hate it !
    Hias

  6. #6
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    The Netherlands
    Posts
    403
    Can't help you here, 'cause I always make a screebshot by using bitblt, but I'm very interested in how they disabled that for that part of the screen. In my school they are using a program that shows on the head computer what the other computers are doing, by making a screenshot of the target computer, so we can't play games anymore. If someone knows how to create a program that disables capturing the screen, this guy's very interested
    There are 10 types of people, those who understand binary and those who don't

    http://merlijn.beyonix.net

  7. #7
    New Member
    Join Date
    Mar 2000
    Posts
    12

    Talking

    XaOz was right, the VBFocus object is the mediaplayer object! To see for yourself, open up Spy++ (if you have it) when you're running your project with the mediaplayer control on it. Go to your program in the tree list, right click "VBFocus" and select "Messages". There's something strange about the object because you won't see any messages as you move your mouse over it, but when you click it and for example access its context menu, it will return messages. I don't know if you'll be able to do much once you have the hwnd of it (using EnumChildWindows) thou

    Edit: When I put two mediaplayer objects on my form, there was only one VBFocus child. So I don't know how it works.. but i dont think it's hwnd can be for one of the objects, or both. I'm happy with the ActiveMovie.hWnd
    Last edited by Frisco; Jun 11th, 2002 at 03:42 AM.

  8. #8
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    obviously none of you have ever heard of overlay.

    wheny ou use hardware acceleration for Media Player, it doesn't print it on the screen. it prints it almost the same way it shows the mouse. it's just faster. you will need to go to options and turn hardware acceleration all the way to 0
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  9. #9
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    and just so you don't ask, you can't take screenshots of the overlay
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  10. #10
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    if you have a dvd-rom, play a dvd and take a screenshot and paste it into paint. if the movie is still playing you can see the overlay, so the picture is moving.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

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