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. callback question

callback question

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 2 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.
  • A Offline
    A Offline
    andyg 101
    wrote on last edited by
    #1

    Can somebody explain to me what a callback function is ? is it just a recursive function or have I missed the point? Andy

    R 1 Reply Last reply
    0
    • A andyg 101

      Can somebody explain to me what a callback function is ? is it just a recursive function or have I missed the point? Andy

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      A callback function is one whose pointer you give to an object or function, and it gets called by the other object or function when a certain condition arises. For example, the SetTimer() Win32 API function can take a pointer to a function that gets called when the timer period elapses. The function that you pass to SetTimer and gets called is the callback function. A slightly different example is used with the EnumFontFamilies() function. You pass a pointer to a callback function, and the callback function gets called once for every font that matches the criteria specified in the call to EnumFontFamiles(). In this case, the callback function is called as many times as needed before the EnumFontFamilies() function returns, as opposed to SetTimer() above, where the callback function is called sometime in the future. Hope this explains it more :)

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      A 1 Reply Last reply
      0
      • R Ryan Binns

        A callback function is one whose pointer you give to an object or function, and it gets called by the other object or function when a certain condition arises. For example, the SetTimer() Win32 API function can take a pointer to a function that gets called when the timer period elapses. The function that you pass to SetTimer and gets called is the callback function. A slightly different example is used with the EnumFontFamilies() function. You pass a pointer to a callback function, and the callback function gets called once for every font that matches the criteria specified in the call to EnumFontFamiles(). In this case, the callback function is called as many times as needed before the EnumFontFamilies() function returns, as opposed to SetTimer() above, where the callback function is called sometime in the future. Hope this explains it more :)

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        A Offline
        A Offline
        andyg 101
        wrote on last edited by
        #3

        Yes that covers it thanks. :-)

        R 1 Reply Last reply
        0
        • A andyg 101

          Yes that covers it thanks. :-)

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          You're welcome :)

          Ryan

          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

          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