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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law