It works fine without &, also Elysia's suggestion also works fine too using the &.
Printable View
Because a static class member does not automatically get the this pointer (all normal method functions of a class do get the "this" pointer transferred by the compiler) , and you need it in your logging part. So you need a way to pass it from your call to DialogBox to the playTone() function. Since there is no parameter from within the DialogBox call that is freely available and gets passed, the only trivial solution is to use a global variable.
--
Mats
It writes perfectly to the log file as I check the contents in the file.
Thank you everyone for the input to help me out, very appreciated.
I thought that was part of the problem.
The other key point here is that the reason you NEED to make the function static is that there's no understanding from Windows' side that you need to pass a "this" (or what the value for "this" might be) when calling a CALLBACK function, so you must use a function that doesn't expect "this" to magically be passed along with the parameters to the function. Hence you must create your own mechanism of asking for the pointer.
--
Mats