phrosty@gmail.com
2/24/2007 4:32:00 PM
On Feb 24, 8:07 am, Mattias Sjögren <mattias.dont.want.s...@mvps.org>
wrote:
> >I'm trying to DllImport the SendMessage and SetWindowTheme APIs, but
> >maintain backward compatibility with Win2k and stay cross-platform
> >with Mono. So I need a way to import these APIs if they are there but
> >fail gracefully if they aren't. Any ideas?
>
> Use System.Environment.OSVersion to check which OS you're running on.
>
> SendMessage should be available on any Windows client OS that .NET
> apps run on.
>
> SetWindowTheme is available in Windows XP (i.e. version 5.1) and
> later.
>
> Mattias
>
That doesn't help.
I need to support Win2K, but use SetWindowTheme when available.
I also need to support Mono, but use SendMessage when it is available.
Preferably without resorting to compiling different versions of the
assembly.
The problem with using DllImport is that it causes the assembly to
fail loading if it can't find the .dll or export.