Thread: Callback function???

  1. #1
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343

    Callback function???

    Hi, I was reading a article on the internet where they mentioned callback function but didnīt explain it. What is a callback function???

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    A callback is a pointer to a function that can be passed around and called when needed.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    160
    Funny... those I just call "pointer to func". A bit more self explaining
    Well english isn't my first language, (it's instead a useless language called danish which only 5 milion people speak!!) so if you think my grammar SUCKS (it does by the way) than you're more then welcome to correct me.
    Hell I might even learn something

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    in windows programing (WIN32 API ect) a callback function is where you process messages sent by windows.

    It is mainly a complex nested switch statement.

    All init, close, mouse, keyboard and paint messages ect are sent to your application and then forked and sent to the dialog that generated them.

    you can process the message or pass it back to windows for default processing.

    this is the standard form

    LRESULT CALLBACK MainCallback(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. callback function v. regular function
    By 7stud in forum C++ Programming
    Replies: 8
    Last Post: 03-24-2005, 11:34 AM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  5. Is it possible to have callback function as a class member?
    By Aidman in forum Windows Programming
    Replies: 11
    Last Post: 08-01-2003, 11:45 AM