Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 414
  • Last Modified:

Auto resizing while playing video?

Hi:
  I have an object of a class derived from CWnd and use this window to play video. (Under VC++4.2 and Win95). What I want to do is that the video image can cover entire client area while the size of the window changed(enlarge of shrink). I don't care the quality of the image. Now I am doing that by handling the ON_WM_WINDOWPOSCHANGED message and using some functions supported by the device driver(for the video playing). The problem is I want to develop a generic application, so I can't use those special functions. Is there anything I can do when I create the displaying window so it can do what I want. I saw an application doing exact the same thing. I went through the Online help and still have no idea. I read the Resizing sample from Microsoft but thats not what I need. I think what I need is something like changing the size of fonts while the size of windows changed. I have no control of the video display.(I'm using MCI drivers and MCI_PUT doesn't work for all cases)
0
danli020797
Asked:
danli020797
  • 2
1 Solution
 
chensuCommented:
You should handle ON_WM_SIZE instead of ON_WM_WINDOWPOSCHANGED. Send MCI_PUT in the handler.

Another easier way is to use MCIWnd window class to play video. You can see the Visual C++ 4.2 documentations for more details:
SDKs/Win32 SDK/Multimedia/Media Control Interface/MCIWnd Window Class.

0
 
danli020797Author Commented:
Thank you for your answer.
The problem I had was a little bit complicate(for me). One of the mci driver I used didn't support MCI_PUT the way it should be so I needed to do it manually. The solution I have now is using the video window as a child window of the main, then use MoveWindow() in WM_SIZE/WM_WINDOWPOSCHANGED handler and it's working ok. The odd thing is if I use WM_SIZE handler with the mci driver that is not support MCI_PUT, I will have problem while moving the whole window without resizing it. There's no problem when I run the same code with another mci driver which implement MCI_PUT correctly but I don't think there's any relation between this. maybe there is some bug in the (bad) mci driver. But I still have a "minor" thing need to solve, which is, if I move the window partly outside off the left side of desktop(rect.left < 0), the video window doesn't move along, any idea? It only happened to the left side.
  The reason I do not use MCIWnd is that I am afraid the MCI window will be destroyed when I switch devices(closing a video device and open another one, for example). If that is not the case, could you please let me know?
  Again, appreciate your help.
0
 
chensuCommented:
Do you use the window style WS_POPUP or WS_CHILD? If it is WS_CHILD, it is likely that the action you described is a bug of the MCI driver. MCIWnd can do everything that MCI command can do. You can keep the window when you switch devices if you create the MCIWnd window without specifying a device or media file.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now