Torus
asked on
WaveInProc, WaveOutProc and Wave Functions
I have written a dll for playing and recording files. Because it has no window handle, I use CALLBACK_FUNCTION in the WaveOutOpen and WaveInOpen and declare the callback function WaveOutProc and WaveInProc. When getting WM_DONE or WIM_DATA, I will
add next buffer and call WaveOutWrite in playging or calling
waveinaddbuffer in recording. However, the functions are
hanged in NT SP5 if I call those wave functions inside the waveInProc or waveOutProc. I see the help saying that only some system function can be called inside the function. But I get worked
in win95.
My question is how to get around this problem in NT SP5?
Can I get any window handle and have a standard
WNDPROC callback to get window message inside the DLL?
if so, how can I do that?
Thanks.
add next buffer and call WaveOutWrite in playging or calling
waveinaddbuffer in recording. However, the functions are
hanged in NT SP5 if I call those wave functions inside the waveInProc or waveOutProc. I see the help saying that only some system function can be called inside the function. But I get worked
in win95.
My question is how to get around this problem in NT SP5?
Can I get any window handle and have a standard
WNDPROC callback to get window message inside the DLL?
if so, how can I do that?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What kind of example? How to create a window? It is simple enough.
Well, something like this:
#define WMDONE WM_USER+1
HWND hWin;
BOOL DllMain(hInstance...fdwRea son...)
{
if(fdwReason==DLL_PROCESS_ ATTACH) {
hWin=CreateWindow("YourWin dowClass", "",WS_POPU P,1,1,1,1,
HWND(0),0,hInst,0);
}
return TRUE;
}
LRESULT YourWindowProc(HWND w,UINT uMsg,...)
{
switch(uMsg) {
case WMDONE:
// Free old buffer here
// Add new buffer here.
break;
default:
return DefWindowProc(...)
}
return 0;
}
void CALLBACK waveOutProc(
HWAVEOUT hwo,
UINT uMsg,
DWORD dwInstance,
DWORD dwParam1,
DWORD dwParam2
)
{
if(uMsg==WOM_DONE) {
PostMessage(WMDONE,hWin,dw Param1,dwp aram2);
}
}
Or specify hWin handle in the waveOutOpen (waveInOpen) call, so there will no need in waveOutProc.
The better way is to take any appropiate sample from the SDK.
Well, something like this:
#define WMDONE WM_USER+1
HWND hWin;
BOOL DllMain(hInstance...fdwRea
{
if(fdwReason==DLL_PROCESS_
hWin=CreateWindow("YourWin
HWND(0),0,hInst,0);
}
return TRUE;
}
LRESULT YourWindowProc(HWND w,UINT uMsg,...)
{
switch(uMsg) {
case WMDONE:
// Free old buffer here
// Add new buffer here.
break;
default:
return DefWindowProc(...)
}
return 0;
}
void CALLBACK waveOutProc(
HWAVEOUT hwo,
UINT uMsg,
DWORD dwInstance,
DWORD dwParam1,
DWORD dwParam2
)
{
if(uMsg==WOM_DONE) {
PostMessage(WMDONE,hWin,dw
}
}
Or specify hWin handle in the waveOutOpen (waveInOpen) call, so there will no need in waveOutProc.
The better way is to take any appropiate sample from the SDK.
ASKER
Yup, I want to use the CALLBACK_WINDOW and get rid of the waveInProc. If so, why can I set up the "YourWindowProc" as a default
message handler? it is necessary to use registerClassEx to do that?
Thanks
message handler? it is necessary to use registerClassEx to do that?
Thanks
ASKER
OK, I got it with using RegisterClass.
Thanks.
Thanks.
ASKER
Thanks