Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making an application run on WinXP/Vista that uses Win7 features

I've developing an app that uses some of the advanced Windows 7 features that werent available on WinXP. Lets say I want to use ChangeWindowMessageFilterEx (or any other calls that were added since Win7), the app compiles and works fine on Win7. But on XP I get "The procedure entry point ChangeWindowMessageFilterEx could not be located in the dynamic link library USER32.dll" BEFORE even the application starts.

Is there any way to run my app on XP without compiling two different versions?

like image 215
pullo_van Avatar asked Feb 24 '23 01:02

pullo_van


1 Answers

You do that by dynamically resolving ChangeWindowMessageFilterEx using LoadLibrary and GetProcAddress. If GetProcAddress returns NULL, you just don't call this function.

See also:
Checking for existence of Windows API Functions
Using Run-Time Dynamic Linking

like image 120
GSerg Avatar answered May 11 '23 22:05

GSerg