Home/Support/Support Forum/AwUsbApi.dll crush after calling AwUsbGetConnectionStatus to a connected hub
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

AwUsbApi.dll crush after calling AwUsbGetConnectionStatus to a connected hub

0 votes
Greetings! I've faced a problem with using AwUsbApi. I'm trying to implement anywhereusb base functionality in a WPF c# project. Everything works fine, I can connect to available hub, I can check it's status etc. The AnywhereUSB Remote Hub Configuration Utility shows the same output, so I know that program works fine. But, when I call AwUsbGetConnectionStatus to get the actual status of a hub, that is already in use by someone else, my program terminates without any error message. I tried to use try catch and dll import with the parameter SetLastError = true, but that didn't work.
Here is the c# code:

// importing the dll
[DllImport("AwUsbApi.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern int AwUsbConnect(string hub, out int status, int timeout, IntPtr handler);

[DllImport("AwUsbApi.dll", CharSet = CharSet.Unicode)]
private static extern int AwUsbDisconnect(string hub);

[DllImport("AwUsbApi.dll", CharSet = CharSet.Unicode)]
private static extern int AwUsbGetConnectionStatus(string hub, out uint ipAddress, out int status, int timeout, IntPtr handler);

private void GetStatus()
{
// this will crash the program if the hub has been connected not by me
var result = AwUsbGetConnectionStatus(AddressTextBox.Text, out ipadress, out int status, 10000, IntPtr.Zero);
Console.WriteLine(result);
}


---

AwUsbApi.dll version is 3.96.259.0
Operating system is Windows 10 x64

I checked the release notes and there was something about get connection status problem. But if I'm not mistaken, this problem was before version 3.96 (that I currently use)
asked Jul 26 in USB by Patreg New to the Community (0 points)

Please log in or register to answer this question.

...