__stdcall in function paramater

94 views Asked by At

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

2

There are 2 answers

0
SoronelHaetir On BEST ANSWER

Put the calling convention inside the parenthesis.

void Function(LRESULT (CALLBACK *f)(HWND, UINT, WPARAM, LPARAM));
0
273K On

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));