The problem is that your application has a dependency on those functions, a dependency that the OS loader tries to resolve at application start-up. But of course, those functions don't exist in XP, so the executable fails to load.
There are two ways around this. First, try delay-loading comctl32.dll. This should remove the load-time dependency and delay the resolution until the function is actually called. Then you just need to take care not to call it where it's not supported.
If that doesn't work, then you would have to bind to TaskDialog
explicitly, via LoadLibrary
and GetProcAddress
. This way, you never explicitly mention the function in a way that the linker would know about, so you don't take a load-time dependency on it. That's a bit more work though, mucking around with function pointers.