0

I've got the Version API Helper functions running and that lets me do x if in y but how is it I set Visual Studio to ignore code if the target operating system does not support it, the issue being:

 ChangeWindowMessageFilterEx

I need it for Windows 7 and above but when compiling the application the function gets included so wont run on XP.

Shrek
  • 327
  • 5
  • 17
  • Are you looking for `WINVER`? http://stackoverflow.com/questions/1439752/what-is-winver – CompuChip Feb 25 '15 at 21:30
  • No, I'm looking to be able to have the function ChangeWindowMessageFilterEx in my project but only be loaded if os => Win 7 but as is the function gets included in the compiled .exe list of functions and stops the .exe running on XP – Shrek Feb 25 '15 at 22:13
  • ... use `#ifdef` on some symbol to conditionally compile code. You can even decide based on the value of some symbol (like `WINVER`). See [this MSDN page](https://msdn.microsoft.com/en-us/library/ew2hz0yd.aspx?f=255&MSPPError=-2147217396) for some info. This is at *compile time*, though, and if I understand your comment, you want it at run-time?? – Steve Feb 25 '15 at 22:53

1 Answers1

1

You would have to use explicit linking, using LoadLibrary and GetProcAddress to get a function pointer to ChangeWindowMessageFilterEx. That way the call is not compiled into your code but it is conditionally executed by your code.

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15