Haumikj Haumer
Haumikj Haumer

Reputation: 31

__stdcall in function paramater

does anybody know if is possible to add __stdcall (CALLBACK) in function parameter like this?:

void Function(LRESULT CALLBACK (*f)(HWND, UINT, WPARAM, LPARAM));

It gives me following error:

a calling convention may not be followed by a nested declarator

Any solutions?

Thx in advance <3

Upvotes: 0

Views: 182

Answers (2)

3CxEZiVlQ
3CxEZiVlQ

Reputation: 38890

Usually it is seen in the manual, for example CallWindowProcW function

the lpPrevWndFunc parameter has the data type WNDPROC. The WNDPROC type is declared as follows:
LRESULT (CALLBACK* WNDPROC) (HWND, UINT, WPARAM, LPARAM);

Thus, the correct syntax is (WNDPROC -> f)

void Function(LRESULT (CALLBACK* f)(HWND, UINT, WPARAM, LPARAM));

Upvotes: 1

SoronelHaetir
SoronelHaetir

Reputation: 15172

Put the calling convention inside the parenthesis.

void Function(LRESULT (CALLBACK *f)(HWND, UINT, WPARAM, LPARAM));

Upvotes: 1

Related Questions