c# - Windows API Code Pack features on windows xp machine -


I have a windows app that needs to work on all platforms of Windows. I have recently downloaded Windows API code pack Has installed and replaced a folder browser with a "normal onfile browser". It was great until I was trying to run my program on Windows XP machine, where I got an exception:

PlatformNotSupportedException, CommonOpenFileDialog requires Vista or later .

I would like to continue using CommonOpenFileDialog for Vista and above, but it is possible to return the old folder browser if it runs in a Windows XP operating system Detects?

More thoughts:

I can find out by using my operating system:

// if Windows Vista or above / if (Environment.OSVersion.Version.Major> = 6)

But the exception is on startup, before the normalofffile dialog is shown. I've heard something about dynamically loading the code, but I have very little experience with it.

So it turns out that I had a solution with everyone I had to do just that:

  if (environment. OSVersion.Version.Major & gt; = 6) {var openCommonDialog = new CommonOpenFileDialog (); } Else {var openFileDialog = new FolderBrowserDialog (); }  

The reason I got crashed on startup is that CommonOpenFileDialog was installed in the designer.cs file. Once my fix has been removed.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -