I tried to use OpenFileDialog
in System.Windows.Forms
, but when I switch the project build type from Mono
to IL2CPP
, it doesn't work anymore.
In IL2CPP
mode i can still use the method by Win32 APIs, but I cannot find a valid solution of how to use IFileDialog COM Interface by P/Invoke.
This code doesn't working because the 'IFileDialog
' is not defined:
[ComImport,Guid("d57c7288-d4ad-4768-be02-9d969532d960"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IFileOpenDialog : IFileDialog
{
// Defined on IModalWindow - repeated here due to requirements of COM interop layer
// --------------------------------------------------------------------------------
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), PreserveSig]
int Show([In] IntPtr parent);
// ......
Anyway, The API which came from Comdlg32.dll
is still working, but it has many shortcomings(cannot remember the path of last selected file/folder and so on).
BTW, I want to not only create a File Selection/Save Dialog, but also create a Folder Selection Dialog.
Does IFileDialog
have a switcher to allow me switch the dialog type?
And, how to use IFileDialog
COM Interface by P/Invoke in IL2CPP
mode of Unity3D?
I will be appreciated if you could give me some valid solutions.