Checking for existence of Windows API Functions

前端 未结 8 1797
鱼传尺愫
鱼传尺愫 2021-01-05 14:17

I am new to Windows programming and I\'m trying to discover the best way to check for the existence of Windows Shell API functions. I want to use some of the new taskbar fea

8条回答
  •  再見小時候
    2021-01-05 15:05

    I disagree with the currrent solutions. You'll end up with quite a bit of unreadable code.

    A nicer alternative is to wrap the functionality in a custom Windows 7-only DLL. For other systems, provide another version of the DLL that implements the same functions. This can often be a no-op. E.g. a function to set the taskbar extensions would be a no-op on older Windows versions.

    The dynamic switching between these DLLs is done by using the delay-load feature of MSVC. You can use a custom hook in your EXE to pick the correct DLL version when the first function in your DLL is called, at which time you know whether you're running on Windows 7.

提交回复
热议问题