Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:24:05+00:00 2026-06-06T02:24:05+00:00

Possible Duplicate: What does a CALLBACK declaration in C do? The prototype of a

  • 0

Possible Duplicate:
What does a “CALLBACK” declaration in C do?

The prototype of a WindowProc() function is this

LRESULT CALLBACK WindowProc(HWND hWnd,UINT message , WPARAM wParan, LPARAM lParam);

But I’ve never come across the CALLBACK keyword, I only know that a callback function is one you pass a pointer to another function to, so what exactly is this CALLBACK over here? and what does it do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:24:07+00:00Added an answer on June 6, 2026 at 2:24 am

    It’s #defined as __stdcall, because that’s what the Win32 API assumes about callback functions. It’s a calling convention – it describes the way a function call is arranged on the low level – how are parameters arranged on the CPU stack, and suchlike. The assumptions about the expected stack layout (i. e. the calling convention) must match between the caller and the callee, otherwise all kinds of fun consequences might ensue.

    Historically, on the Intel CPUs there were multiple calling conventions; more if you count non-Microsoft compilers. Even more if you count languages other than C[++] that are capable of calling and getting called by Windows API. Making sure your Windows API callbacks are explicitly marked as __stdcall to match the WinAPI expectation is a good practice. In some cases, depending on compiler and settings, __stdcall is the default calling convention (i. e. you can safely omit CALLBACK), but not always.

    Back in Win16, CALLBACK was defined as far pascal. That’s even less likely to be the default for user functions, especially in a C program. The fact that callbacks were assumed to have a Pascal calling convention was an historical artifact. It also worked as a microoptimization.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What does this “(function(){});”, a function inside brackets, mean in javascript ?
Possible Duplicate: Does PHP have threading? I found this: http://php.net/manual/en/function.pcntl-fork.php But I can't tell
Possible Duplicate: How does foreach work when looping through function results? If I have
Possible Duplicate: What does ||= mean? In this previous question, I asked about an
Possible Duplicate: How does this bash fork bomb work? Today one of my friend
Possible Duplicate: Why does this() and super() have to be the first statement in
Possible Duplicate: Does readdir() guarantee an order? I'm guessing this isn't the case, and
Possible Duplicate: why does initializing subclasses require calling the super class's same init function?
Possible Duplicate: What does the >?= operator mean? I found this code segment ...
Possible Duplicate: Why does “abcd”.StartsWith(“”) return true? Something similar to this being true caught

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.