Solved

MCIWndCreate & MCIWndDestroy

Posted on 1997-06-07
3
921 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now