Change the return value for ExtractIconEx from HICON to UINT and make the function call directly user32.PrivateExtractIconEx.