I'm using shell 32 to get some file descriptions. It works perfect in Visual Studio 2010, but when it comes inside unity3d it crashes.

The code is:

using Shell32;

ShellClass shell = new ShellClass();
Folder objFolder = shell.NameSpace(path);

string fileTitle = objFolder.GetDetailsOf(objFolder.Items().item(0),21); //Crash on this line

I appreciate your help.

  • \$\begingroup\$ Sorry about the tags, I couldn't add more, but they are actually, "Shell32", "Crash", "Error" \$\endgroup\$
    – Kourosh
    Sep 22 '11 at 7:39
  • 1
    \$\begingroup\$ Do you have to use Shell32? It won't of course work on Mac, iOS, Android, or the WebPlayer. \$\endgroup\$ Sep 22 '11 at 9:53
  • \$\begingroup\$ What is column 21? \$\endgroup\$ Sep 22 '11 at 9:56
  • \$\begingroup\$ I'm writing a plugin, it won't need to be there for compile. just using inside the editor... 21 will return the title \$\endgroup\$
    – Kourosh
    Sep 22 '11 at 10:35
  • 1
    \$\begingroup\$ Try using System.Diagnosics.FileVersionInfo (msdn.microsoft.com/en-us/library/91sft6af.aspx) \$\endgroup\$
    – Nevermind
    Sep 22 '11 at 12:45

Using Shell32 isn't portable.

Have you tried using the .net equivalents?


  • \$\begingroup\$ Thanks Tetrad, I looked into it. It won't give access to details tab. \$\endgroup\$
    – Kourosh
    Sep 22 '11 at 16:12

Yes, use the System.IO; namespace

there you have multiple interesting methods like

File.Exists(...) Directory.Exists( ...) Path.GetDirectoryName(...) Path.Combine(path, filename) Path.GetFileNameOnly(...)

( note: the method I wrote are not exactly correctly named, but you get the picture) :)

Cheers T.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.