This is a old post that has been migrated. While the content is probably very obsolete, in case someone needs it, it's here. Also makes great filler for a empty blog.
This is a common error that most people will see when converting old MFC applications to be 64-bit compatible. It's pretty well known, and the fix for this has been made available public on many sources - but in case anyone manages to find this page before anything else here is the solution.
Here is the error message that you will encounter:
Hello.cpp(45): error C2440: 'static_cast' : cannot convert from 'void (__cdecl Hello::* )(UINT)' to 'void (__cdecl CWnd::* )(UINT_PTR)'
Cast from base to derived requires dynamic_cast or static_cast
...of course you probably don't have a Hello class, so not exactly the same - but similar enough.
Doesn't really make much sense at first sight - and it will make even less sense if you double click on the error message in Visual Studio, because it will take you to this line:
Which is another one of those cases where VS tries to outsmart you - ignore this, and track down all instances of
::OnTimer(UINT nIDEvent) and change it to
For those who actually care about what is going on, this is caused because the type
UINT_PTR are interoperable in 32-bit, while they are not in 64-bit (for obvious reasons) - hence it attempts to be smart but the conversion fails.
Sadly, the error isn't very clear at first sight, and probably would have been very nice if Intellisense recognized it and gave out a slightly better error message.