In addition to what Sergey already told you, the Ansi or Widechar versions (suffixed by A or W respectively) should be used consistently with the program. So unless you have real necessity to use one or another, and you are well aware of what you are doing, you should always use the general version of the function, i.e. CallWindowProc, and let the compiler choose which is appropriate.
Anyway the errors in your code are in order:
1. Use of deprecated function
SetWindowLong
. Use instead the newer
SetWindowLongPtr
.
2. You don't have to cast the function to an (int), especially if you're compiling on x64 system it will cause address violation because an int is 32 bits, while the pointer is 64. cast the value as a (LONG_PTR) as specified in
the function reference[
^].
3. you may wan t use the function
SetWindowSubclass[
^] for subclassing instead of SetWindowLongPtr.