Hi Scott,
Yes, that's what exactly I did! I put a void, and it crashed. Even the debug
version crashed under Windows NT. Without using message handlers, I can use
callback function instead. I have done that and it worked nicely in both builds.
However, I wonder why void is not permitted, since other window handlers does
permit void return, such as those handlers which handles dialog controls.
If I use that prototype you suggested,what do I return in my function? For
example:
LRESULT CSomeClass::OnSomeMessage(WPARAM wParam, LPARAM lParam)
{ //my code
// how to end this function correctly?
Quote:
}
Thank you very much! Hope you could help me with this!
Soon Chieh
Quote:
> > Hi,
> > Could someone please tell me how to use WaveOutOpen with window
> > handler callback? I used the below code to playback sound in my Visual
> > C++ program.
> > waveOutOpen(WaveIn,WAVE_MAPPER,Format,(DWORD)m_hWnd,0,CALLBACK_WINDOW)
> > with m_hWnd being the window handle data member of my CWnd class
> > (the function is called in a modeless dialog, so the handle is actually
> > a handle of the dialog object, of the CDialog class, which is derived
> > from CWnd) . However, when I run the program in release build mode, it
> > give me illegal operation every time I finished recording and the my
> > window handler is called. There is no problem when I change to function
> > callback (waveOutProc). And when I disabled the window message handler,
> > no problem occured as well. So I think the problem really lies with my
> > window message handler.
> > What is the correct way to implement our own window message
> > handlers?
> > Hope someone could help me out! Thank you very much.
> > Yours sincerely,
> > Soon Chieh
> Your own window message handlers should have a line like this in the message
> map:
> ON_MESSAGE(WM_SOME_MESSAGE, OnSomeMessage)
> and the message handler function *must* have a prototype like this:
> LRESULT CSomeClass::OnSomeMessage(WPARAM wParam, LPARAM lParam);
> If you prototype the function with a void return it crashes in release build.
> --
> Scott McPhillips [VC++ MVP]