pinvoke TCHAR[]
объявленный метод в win32(c++) dll:
Код:
extern "C" WIN32DLL_API int fnWin32Dll(HWND hwnd,__in_opt LPTSTR str);
Код:
[DllImport(@"C:\Users\Дмитрий Станский\Documents\visual studio 11\Projects\Win32DllInDotNetExample\Debug\Win32Dll.dll")]
private static extern int fnWin32Dll(IntPtr hWnd, [Out] StringBuilder str);
private void button1_Click(object sender, RoutedEventArgs e)
{
WindowInteropHelper wih=new WindowInteropHelper(Application.Current.MainWindow);
StringBuilder outSb=new StringBuilder(512);
StringBuilder sb = new StringBuilder();
sb.AppendFormat("The dilog returned with btn # {0} pressed, the result is: \n{1}", fnWin32Dll(wih.Handle, outSb), outSb);
MessageBox.Show(sb.ToString());
}
private static extern int fnWin32Dll(IntPtr hWnd, [Out] StringBuilder str);
private void button1_Click(object sender, RoutedEventArgs e)
{
WindowInteropHelper wih=new WindowInteropHelper(Application.Current.MainWindow);
StringBuilder outSb=new StringBuilder(512);
StringBuilder sb = new StringBuilder();
sb.AppendFormat("The dilog returned with btn # {0} pressed, the result is: \n{1}", fnWin32Dll(wih.Handle, outSb), outSb);
MessageBox.Show(sb.ToString());
}
Поищи по форуму - было, решали, заработало.