What is a callback function?

Source: Internet
Author: User
What is a callback function? Msdn

What is a callback function?

To call most DLL functions from Microsoft Visual Basic for Applications (VBA), you only need to compile the VBA function that calls the DLL function. However, to call a function that requires a callback function, you must compile a VBA function that can call the DLL function. Then, the DLL function calls another VBA function (callback function) that has been defined in the project ). Do not directly call the VBA callback function. The DLL function will be called for you. It is a conceptual diagram of how callback functions work.

How the callback function works

The DLL functions that require callback functions are usually functions that must be executed repeatedly. For example, the settimer API function requires a callback function whenever the specified interval ends. You may use it to update the clock on the form once a second, or display a form every hour. This is a simple task in Microsoft Access, which provides a timer control used on the access form. However, other Microsoft Office XP applicationsProgramThere is no timer control. You can use the settimer function to create a timer.

Other DLL functions that require callback functions are enumeration functions that can be used to enumerate a group of Microsoft Windows objects: enumwindows, enumprinters, enumfontfamilies, and so on. For example, the enumwindows function enumerates all existing windows and calls the callback function for each window. You can use the enumwindows callback function to operate on each available window, such as obtaining the title Text of the window or determining its position on the screen.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.