Solved

MCIWndCreate & MCIWndDestroy

Posted on 1997-06-07
3
946 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
  • 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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