This message usually appears only during development phases, not on the end-user machine. The message appears because you modify only the resources from the package and rebuild it, without increasing the version number, so Windows Installer sees there is a package with the same product code and name on the machine, but with a different package code.
Your users will never get this message because I assume you will increase the version number when releasing the package. This is also based on the name of your function i.e. "CheckPreviousVersion".
If you want a custom message to appear if you found an older version on the machine make sure you first have the old version installed, you currently have the latest version installed, but using another previously built package (i.e. different package code).