Creating an application on WinXP / Vista that uses Win7 features

I am developing an application that uses some of the advanced features of Windows 7 that are not available on WinXP. Suppose I want to use ChangeWindowMessageFilterEx (or any other calls that were added after Win7), the application compiles and works fine on Win7. But on XP, I get: "The entry point of the ChangeWindowMessageFilterEx procedure cannot be located in the dynamic link library USER32.dll" BEFORE the application even starts.

Is there a way to run my application on XP without compiling two different versions?

+4
source share
1 answer

You do this by dynamically resolving ChangeWindowMessageFilterEx using LoadLibrary and GetProcAddress . If GetProcAddress returns NULL , you simply do not call this function.

See also:
Check for Windows API Features
Using dynamic snapping at runtime

+8
source

All Articles