Solved

MCIWndCreate & MCIWndDestroy

Posted on 1997-06-07
3
951 Views
Last Modified: 2013-12-03
i am trying to play an avi file.
I manage to start mci and play the file.
However, i want Mci to close down automatically when it has finished playing the file.
I done the following
if (m_videoWnd == NULL)
      {
            m_videoWnd = MCIWndCreate(this->GetSafeHwnd(),
            AfxGetInstanceHandle(),
            WS_CAPTION | WS_VISIBLE | MCIWNDF_SHOWPOS | MCIWNDF_SHOWNAME|MCIWNDF_NOTIFYMODE,
            filename);
            MCIWndPlay(m_videoWnd);
      }

Thanks in advance
0
Comment
Question by:manoj060697
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
ramshank earned 50 total points
ID: 1397906
You have used the correct options  of creating the MCIWnd by using MCIWNDF_NOTIFYMODE as on of your options.
By using this option you will recieve a notification message

MCIWNDM_NOTIFYMODE
wParam = (WPARAM) (HWND) hwnd;
lParam = (LPARAM) (LONG) mode;

you should handle the notification message . Try this with your window message handler

case MCIWNDM_NOTIFYMODE:
    if (lParam == MCI_MODE_STOP){        // device stopped
        MessageBox(hwnd,"","Closing Device",MB_OK);
        MCIWndClose(g_hwndMCIWnd);
    }
    break;



0
 

Author Comment

by:manoj060697
ID: 1397907
Since I am using MFC and I create the window in my view class
how exactly do i add a handler for MCIWNDM_NOTIFYMODE ?

Thanks


0
 
LVL 1

Expert Comment

by:ramshank
ID: 1397908
if you are using mfc treat the notification message as a user message and add your own handler without the help of classwizard
like this
declare the message handler in your .h file

afx_msg LRESULT OnMciWndNotification(WPARAM wParam, LPARAM lParam);

add this to your message map code

BEGIN_MESSAGE_MAP(CMyWnd, CMyParentWndClass)
    ON_MESSAGE(MCIWNDM_NOTIFYMODE,OnMciWndNotification )
END_MESSAGE_MAP()


hanlde the function in your .cpp file like any other handler.

I hope this information will be helpful to you . in case you need more information , please read  MFC Message Maps  from the VC++ books online or MSDN.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question