About waveinopen
-
Hello, I have a question about callback function. My code is waveInOpen(&hWav,0, &wfx,WaveInCallback ,0, CALLBACK_FUNCTION); But it comes some problems, the error message is error C3867: 'p2p::Form1::WaveInCallback': function call missing argument list; use '&p2p::Form1::WaveInCallback' to create a pointer to member I dont realize what happened. Can anybody solve this question for me? Jane
-
Hello, I have a question about callback function. My code is waveInOpen(&hWav,0, &wfx,WaveInCallback ,0, CALLBACK_FUNCTION); But it comes some problems, the error message is error C3867: 'p2p::Form1::WaveInCallback': function call missing argument list; use '&p2p::Form1::WaveInCallback' to create a pointer to member I dont realize what happened. Can anybody solve this question for me? Jane
-
This error happens when you tried to take the address of a member function without qualifying the member function with its class name and the address-of operator. Can you show the callback function declaration?
- NS -
-
OK. void CALLBACK WaveInCallback(HWAVEIN hw, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD dwParam2) { waveInAddBuffer(hw, (WAVEHDR*)dwParam1, sizeof(WAVEHDR)); } I create it in the From.h. But I don't know where to allocate it.
Isn't it a static function? AFAIK it should be static function. Also I found a mismatch with the documentation in MSDN. See... void CALLBACK waveInProc( HWAVEIN hwi, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); You are using DWORD_PTR instead of DWORD. But I am not sure about this :(
- NS -
-
Isn't it a static function? AFAIK it should be static function. Also I found a mismatch with the documentation in MSDN. See... void CALLBACK waveInProc( HWAVEIN hwi, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); You are using DWORD_PTR instead of DWORD. But I am not sure about this :(
- NS -
-
Try to cast like waveInOpen(&hWav,0, &wfx,(DWORD_PTR)WaveInCallback ,0, CALLBACK_FUNCTION);
- NS -
It comes other errors.@@ 1.error C3374: can't take address of 'p2p::Form1::WaveInCallback' unless creating delegate instance 2.error C2440: 'type cast' : cannot convert from 'void (__clrcall p2p::Form1::* )(HWAVEIN,UINT,DWORD_PTR,DWORD_PTR,DWORD)' to 'DWORD_PTR'
-
It comes other errors.@@ 1.error C3374: can't take address of 'p2p::Form1::WaveInCallback' unless creating delegate instance 2.error C2440: 'type cast' : cannot convert from 'void (__clrcall p2p::Form1::* )(HWAVEIN,UINT,DWORD_PTR,DWORD_PTR,DWORD)' to 'DWORD_PTR'
-
Please show me the declaration of the callback function. Not in the cpp but inside the class in header file.
- NS -
NS17 wrote:
Please show me the declaration of the callback function.
It's declared in
mmsystem.h
:void CALLBACK waveInProc(
HWAVEIN hwi,
UINT uMsg,
DWORD dwInstance,
DWORD dwParam1,
DWORD dwParam2
);
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Please show me the declaration of the callback function. Not in the cpp but inside the class in header file.
- NS -
public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } int call_id; void CALLBACK WaveInCallback(HWAVEIN hw, UINT uMsg,DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD dwParam2) { WAVEHDR* curhdr = (WAVEHDR*)dwParam1; waveInAddBuffer(hw, curhdr, sizeof(WAVEHDR)); } ............ I put in the class form1
-
public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } int call_id; void CALLBACK WaveInCallback(HWAVEIN hw, UINT uMsg,DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD dwParam2) { WAVEHDR* curhdr = (WAVEHDR*)dwParam1; waveInAddBuffer(hw, curhdr, sizeof(WAVEHDR)); } ............ I put in the class form1
minihotto wrote:
public ref class Form1 : public System::Windows::Forms::Form
You very certainly wanted to ask that in the "Managed C++"-Forum?!? :^)
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
Douglas Adams, "Dirk Gently's Holistic Detective Agency" -
minihotto wrote:
public ref class Form1 : public System::Windows::Forms::Form
You very certainly wanted to ask that in the "Managed C++"-Forum?!? :^)
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
Douglas Adams, "Dirk Gently's Holistic Detective Agency"I agree ask on the correct forum.
-
public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } int call_id; void CALLBACK WaveInCallback(HWAVEIN hw, UINT uMsg,DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD dwParam2) { WAVEHDR* curhdr = (WAVEHDR*)dwParam1; waveInAddBuffer(hw, curhdr, sizeof(WAVEHDR)); } ............ I put in the class form1
-
NS17 wrote:
Please show me the declaration of the callback function.
It's declared in
mmsystem.h
:void CALLBACK waveInProc(
HWAVEIN hwi,
UINT uMsg,
DWORD dwInstance,
DWORD dwParam1,
DWORD dwParam2
);
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne