kesari

Hi,

Can any one help me write an equivalent code for the below lines using DLLImport instead of adding a reference and distributing Shell32.dll to users.

Shell32.ShellClass sc = new Shell32.ShellClass();

Shell32.Folder SrcFlder = sc.NameSpace(args[0]);

Shell32.Folder DestFlder = sc.NameSpace(args[1]);

Shell32.FolderItems items = SrcFlder.Items();

DestFlder.CopyHere(items, 20);

Thanks and Regards,

Kesari Suresh.




Re: .NET Base Class Library DLL Import help.

Feng Chen - MSFT

Hi kesari,

Shell32.dll is a COM dll, so you cannot use DLLImport on it. And you don't need to distribute it to users, because every version of windows system now being widely used includes this dll in %windir%\system32.

But I'd like to know what exactly problem you got

Thanks!






Re: .NET Base Class Library DLL Import help.

nobugz

using System;
using System.IO;

namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
foreach (string path in Directory.GetFiles(args[0]))
File.Copy(path, Path.Combine(args[1], Path.GetFileName(path)), true);
}
}
}

You'll need to add error handling.





Re: .NET Base Class Library DLL Import help.

Feng Chen - MSFT

Hi kesari,

We are marking this issue as "Answered". If you have any new findings or concerns, please feel free to unmark the issue.

Thanks!