Discussion:
Receiving WM_GRAPHNOTIFY message in an MFC Dialog program.
(too old to reply)
davidb
2006-08-04 13:50:21 UTC
Permalink
// --------- The Answer------//

This question was asked in 2001, for everione having same Problem with
SetNotifyWindow in MFC, here's what you have to do.

Use
ON_MESSAGE(WM_GRAPHNOTIFY,OnGraphNotifyCommand)
instead
ON_COMMAND(WM_GRAPHNOTIFY, OnGraphNotifyCommand)

OnGraphNotifyCommand looks like:

LRESULT CQuickmailDlg::OnGraphNotify(WPARAM wParam, LPARAM lParam){
long evCode;
LONG param1, param2;

// Get all events
while (SUCCEEDED(m_pGraph->m_pEvent->GetEvent(&evCode,&param1,
&param2, 0))) {
m_pGraph->m_pEvent->FreeEventParams(evCode, param1, param2);

switch (evCode) {
case EC_COMPLETE:
// playback complete
MessageBox("EC_COMPLETE");
break;
}
}

return NOERROR;
}

best Regards,
Dave

// --------- The Question ------//
Hi,
I'm new to directX/directShow programming and have a newbie
question.
I've been trying to get event notification to work with my MFC dialog
project. I could get the win32 sample code segment provided under the
MSDN
page: "DirectX 8.0(C++)/DirectShow/About DirectShow/Event Notification
In
Direct Show" to work with a win32 program. The lines of interest are:

#define WM_GRAPHNOTIFY WM_APP + 1 // Private message.
...
pEvent->SetNotifyWindow((OAHWND)g_hwnd, WM_GRAPHNOTIFY, 0);
...
... in windowproc ...
case WM_GRAPHNOTIFY:
HandleEvent(); // Application-defined function.
break;
...
etc.

This works great, and the program gets notification of the graphnotify
events.

I would like to replicate this in MFC, where the windowproc message
loop is
hidden and one needs to use message maps instead. To replicate the
functionality, I've added the following lines:

... in mydlg.h ...
afx_msg void OnGraphNotifyCommand();

... in mydlg.cpp ...
#define WM_GRAPHNOTIFY WM_USER + 1
...
ON_COMMAND(WM_GRAPHNOTIFY, OnGraphNotifyCommand)
...
pEvent->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0);
...
void CMFCVideoInDlgWithEventsDlg::OnGraphNotifyCommand()
{
... handle message ...

}

The video plays fine in the dialog window, but I am do not get any
messages?? I'm using a regular MFC DLL project setup with a dialog
class and
a app class. Is there something else that needs to be setup?

Any pointers or help with ideas will be greatly appreciated.

Regards,
Kumar Chellapilla
***@natural-selection.com
The March Hare [MVP]
2006-08-04 15:20:23 UTC
Permalink
Post by davidb
Any pointers or help with ideas will be greatly appreciated.
Read the other posts in this newsgroup. What is the most common one of
late?
--
Microsoft MVPs: http://www.microsoft.com/mvp and
MVPs.org site http://www.mvps.org
My dshow site: http://tmhare.mvps.org
Loading...