Проблема Need help for C# approach to ISArcEx

Timick

Старожил
Полноценно смогу посмотреть после 6 января, но, такое ощущение, что все эти атрибуты [MarshalAs(UnmanagedType.BStr)] лишние - рядом с FreeArc, в документации, лежит пример использования для C# - не думал сделать по аналогии?
 

BLACKFIRE69

Новичок
it feels like all these attributes [MarshalAs(UnmanagedType.BStr)] are redundant - next to FreeArc, in the documentation, there is an example of use for C# - didn't you think to do it by analogy?
@Timick
i also tried the following but no luck.

>> Library - Delphi <<

type
TCallback = function(OverallPct, CurrentPct, DiskTotalMB,
DiskExtractedMB: Integer; DiskName, CurrentFile, TimeStr1, TimeStr2,
TimeStr3, Speed: PWideChar): longint; stdcall;

var
DiskName: WideString;

function ISArcExInit(..., Mycallback: TCallback): boolean; stdcall;

TCallback(Mycallback)(..., StringToOleStr(DiskName), ...)


>> Native App - C # <<

--> Structures:
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate long Callback(int OverollPct, int CurrentPct,
int DiskTotalMB, int DiskExtractedMB,
[MarshalAs(UnmanagedType. LPWStr)] string DiskName,
[MarshalAs(UnmanagedType. LPWStr)] string CurrentFile,
[MarshalAs(UnmanagedType. LPWStr)] string TimeStr1,
[MarshalAs(UnmanagedType. LPWStr)] string TimeStr2,
[MarshalAs(UnmanagedType. LPWStr)] string TimeStr3,
[MarshalAs(UnmanagedType. LPWStr)] string Speed);

>> Library - Delphi <<

type
TCallback = function(OverallPct, CurrentPct, DiskTotalMB,
DiskExtractedMB: Integer; DiskName, CurrentFile, TimeStr1, TimeStr2,
TimeStr3, Speed: UnicodeString): longint; stdcall;

var
DiskName: UnicodeString;

>> Native App - C # <<

--> Structures:
[UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet =CharSet. Unicode)]
public delegate long Callback(int OverollPct, int CurrentPct,
int DiskTotalMB, int DiskExtractedMB,
[MarshalAs(UnmanagedType. BStr)] string DiskName,
[MarshalAs(UnmanagedType. BStr)] string CurrentFile,
[MarshalAs(UnmanagedType. BStr)] string TimeStr1,
[MarshalAs(UnmanagedType. BStr)] string TimeStr2,
[MarshalAs(UnmanagedType. BStr)] string TimeStr3,
[MarshalAs(UnmanagedType. BStr)] string Speed);

I'll be able to take a full look after January 6.
thanks...
 
Последнее редактирование:
Сверху