Click here to Skip to main content
15,746,062 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the MCI command
C++
mciSendString(lpszCom,NULL,0,hwndCallback)

inside an MFC dialog and I need to trap the MM_MCINOTIFY message using a window procedure. The hwndCallback parameter is the handle to a callback window. I have coded the following window procedure:

C++
LRESULT CALLBACK MyDlg::WindowProc(HWND hwnd, 
                                   UINT uMsg, 
                                   WPARAM wParam, 
                                   LPARAM lParam)
{   
     switch(uMsg)
     {   case MM_MCINOTIFY:

            // DO SOMETHING HERE
            return 0;

         default:
            return WindowProc(hwnd,uMsg,wParam,lParam);
     }
}


Does anyone know if the Callback function is correctly coded ??
Does anyone know to what the hwndCallback parameter should be set equal to ??
Posted
Updated 18-Mar-12 4:08am
v2

1 solution

Howdy.

Reading the docs, it appears that your callback function isn't quite right..
mciSendString[^]
MM_MCINOTIFY[^]

If you take a closer look at the command, it will fire a MM_MCINOTIFY message at the window specified in the call to mciSendString. From there, you can determine the reason for the callback - i.e
MCI_NOTIFY_ABORTED, MCI_NOTIFY_FAILURE, MCI_NOTIFY_SUCCESSFUL or MCI_NOTIFY_SUPERSEDED


As for the question of what should hwndCallback hold? Simple, the HWND of the window that you wish to have mciSendString fire the callback message at - i.e, the HWND that owns the MyDlg::WindowProc function.


You may find some useful information in this article: Using mciSendString to play media files[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900