S
Steve B.
Hi,
I'm trying to enumerate connnections on the device.
I've already write this code, but it throw a ArgumentNullException :
[DllImport("cellcore.dll",EntryPoint="ConnMgrEnumDestinations",SetLastError=true)]
private static extern int ConnMgrEnumDestinations(int nIndex, IntPtr
pDestinationInfo);
public static DestinationInfo[] EnumConnections()
{
IntPtr hDestInfo = IntPtr.Zero;
ArrayList result = new ArrayList();
while(ConnMgrEnumDestinations(result.Count, hDestInfo) != -2147467259) //
This line throw the exception
{
DestinationInfo di = new DestinationInfo();
di = (DestinationInfo)Marshal.PtrToStructure(
hDestInfo,
typeof(DestinationInfo)
);
result.Add(di);
}
return result.ToArray(typeof(DestinationInfo)) as DestinationInfo[];
}
[StructLayout(LayoutKind.Sequential)]
public struct DestinationInfo
{
Guid guid;
string description;
}
What's wrong with this code ?
I'm trying to enumerate connnections on the device.
I've already write this code, but it throw a ArgumentNullException :
[DllImport("cellcore.dll",EntryPoint="ConnMgrEnumDestinations",SetLastError=true)]
private static extern int ConnMgrEnumDestinations(int nIndex, IntPtr
pDestinationInfo);
public static DestinationInfo[] EnumConnections()
{
IntPtr hDestInfo = IntPtr.Zero;
ArrayList result = new ArrayList();
while(ConnMgrEnumDestinations(result.Count, hDestInfo) != -2147467259) //
This line throw the exception
{
DestinationInfo di = new DestinationInfo();
di = (DestinationInfo)Marshal.PtrToStructure(
hDestInfo,
typeof(DestinationInfo)
);
result.Add(di);
}
return result.ToArray(typeof(DestinationInfo)) as DestinationInfo[];
}
[StructLayout(LayoutKind.Sequential)]
public struct DestinationInfo
{
Guid guid;
string description;
}
What's wrong with this code ?