0

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

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298

2 Answers2

1

Put the calling convention inside the parenthesis.

void Function(LRESULT (CALLBACK *f)(HWND, UINT, WPARAM, LPARAM));
SoronelHaetir
  • 14,104
  • 1
  • 12
  • 23
1

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));
273K
  • 29,503
  • 10
  • 41
  • 64