0

I want to localize a folder name. While I haven't found any method in C# Microsoft provides the C++ function SHSetLocalizedName.

I should be able to access this function by declaring it like this:

[System.Runtime.InteropServices.DllImport("Shell32.dll")]
private static extern IntPtr SHSetLocalizedName(string path, string resourcePath, int resourceID);

However, how do I provide the necessary parameters? I probably need an unmanaged resource file? And how do I know the ID of the resource string?

Thanks for any hints.

Jan
  • 633
  • 11
  • 22
  • Yes, you have to create an unmanaged string resource table. Once you do, you never have to guess at the ID since that's something you specify when you create the table. This is *not* easy to do in a C# project, use a C++/CLI project instead. Double-click the app.rc file, right-click, Add Resource, String Table. You then don't need the pinvoke declaration anymore either. – Hans Passant Jan 19 '16 at 11:23
  • Thanks, that explains it. – Jan Jan 20 '16 at 12:33

0 Answers0