__stdcall / CALLBACK

From: Chrynne Schumptze (ChrynneSchumptze_at_discussions.microsoft.com)
Date: 09/15/04


Date: Wed, 15 Sep 2004 09:01:04 -0700

Hi
I'm trying to make some functionality which will operate in a similar way to
the EnumWindows function, and I've got a function call defined as

typedef BOOL (CALLBACK *MATCHPROC)(_TCHAR*);

few questions:
1) I've noticed that CALLBACK is defined as __stdcall, in windows.h. If I
include <windows.h> and use the CALLBACK syntax, it works, but if I don't
include <windows.h> and use __stdcall then it gives "C2059: syntax error:
__stdcall".
Oddly, if I *don't* include windows.h and use __stdcall , that's also fine.
Why is this?

2) Is CALLBACK necessary? In order to make the called function "clean the
stack itself", is that right?

-- 
-----------------------------------
Gubarsky's Law of Cybernetic Entomology:
There's always at least one more bug.


Relevant Pages

  • Re: SendMessageCallback or Alternative Example
    ... When I first compile the code like the way your example code is, ... callback function as __stdcall but problem still exist. ... LRESULT lResult) ...
    (microsoft.public.vc.mfc)
  • Re: Need to use a DLL with callback function in VB6, how?
    ... Now I can call the function to set the callback pointer and I ... are you sure this DLL is "compatible" with VB6? ... And I have used the stdcall directive in Delphi wherever I could to ... Declare Sub SetCallbackProcedure Lib "Dll1" ...
    (microsoft.public.vb.winapi)
  • Re: recompile a DLL with _stdcall for VB
    ... Microsoft MVP, MCSD ... __stdcall myFunctionwould be enough but I am wrong. ... BOOL DLLEXPORT readyToStartCallback(void (CALLBACK* lpfnReadCallback) ... void CALLBACK TimerProc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD ...
    (microsoft.public.vc.language)
  • Re: Interop: Callbacks und Event Raising?
    ... Damit Callbacks wirklich per _stdcall arbeiten, ... > Nun bekommt aber jenes ErstelleHandle die Callback mit. ... Next by Date: ...
    (microsoft.public.de.german.entwickler.dotnet.framework)
  • Re: SendMessageCallback or Alternative Example
    ... callback function as __stdcall but problem still exist. ... LRESULT lResult) ... int somefunction (HWND hwndToSendMessageTo) ...
    (microsoft.public.vc.mfc)