Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. About waveinopen

About waveinopen

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
14 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    minihotto
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • M minihotto

      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

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #2

      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 -

      M 1 Reply Last reply
      0
      • N Nishad S

        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 -

        M Offline
        M Offline
        minihotto
        wrote on last edited by
        #3

        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.

        N 1 Reply Last reply
        0
        • M minihotto

          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.

          N Offline
          N Offline
          Nishad S
          wrote on last edited by
          #4

          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 -

          M 1 Reply Last reply
          0
          • N Nishad S

            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 -

            M Offline
            M Offline
            minihotto
            wrote on last edited by
            #5

            Appreciate for ur reply. But it's still same.

            N 1 Reply Last reply
            0
            • M minihotto

              Appreciate for ur reply. But it's still same.

              N Offline
              N Offline
              Nishad S
              wrote on last edited by
              #6

              Try to cast like waveInOpen(&hWav,0, &wfx,(DWORD_PTR)WaveInCallback ,0, CALLBACK_FUNCTION);

              - NS -

              M 1 Reply Last reply
              0
              • N Nishad S

                Try to cast like waveInOpen(&hWav,0, &wfx,(DWORD_PTR)WaveInCallback ,0, CALLBACK_FUNCTION);

                - NS -

                M Offline
                M Offline
                minihotto
                wrote on last edited by
                #7

                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'

                N 1 Reply Last reply
                0
                • M minihotto

                  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'

                  N Offline
                  N Offline
                  Nishad S
                  wrote on last edited by
                  #8

                  Please show me the declaration of the callback function. Not in the cpp but inside the class in header file.

                  - NS -

                  D M 2 Replies Last reply
                  0
                  • N Nishad S

                    Please show me the declaration of the callback function. Not in the cpp but inside the class in header file.

                    - NS -

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    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

                    N 1 Reply Last reply
                    0
                    • N Nishad S

                      Please show me the declaration of the callback function. Not in the cpp but inside the class in header file.

                      - NS -

                      M Offline
                      M Offline
                      minihotto
                      wrote on last edited by
                      #10

                      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

                      J N 2 Replies Last reply
                      0
                      • M minihotto

                        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

                        J Offline
                        J Offline
                        jhwurmbach
                        wrote on last edited by
                        #11

                        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"

                        H 1 Reply Last reply
                        0
                        • J jhwurmbach

                          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"

                          H Offline
                          H Offline
                          Hamid Taebi
                          wrote on last edited by
                          #12

                          I agree ask on the correct forum.

                          1 Reply Last reply
                          0
                          • M minihotto

                            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

                            N Offline
                            N Offline
                            Nishad S
                            wrote on last edited by
                            #13

                            I am not sure about this coding. :( In C++, it should be static declaration. Try to make it static function.

                            - NS -

                            1 Reply Last reply
                            0
                            • D David Crow

                              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

                              N Offline
                              N Offline
                              Nishad S
                              wrote on last edited by
                              #14

                              :)

                              DavidCrow wrote:

                              It's declared in mmsystem.h:

                              I meant how he declared the the function to use as callback.

                              - NS -

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups