I found already a couple of threads about error 1097, but none of those helped in my case.
I am programming in LabVIEW 2021 SP1 (32 bit) under Windows10.
I have a PicoScope 3406DMSO connected to a USB 2.0 port (3.0 port is not available at my computer), downloaded and installed the PicoScope6 software, which connects to the scope without problems.
I downloaded as well the LabVIEW examples, the shared library and the SDK (32 bit).
As a first test, I ran PicoScope3000aOpen.vi from the examples. The VI runs without any problems.
As a "HelloWorld" example, I just call ps3000a.dll::ps3000aOpenUnit-2 and close the unit again by calling ps3000a.dll::ps3000aCloseUnit-2. The "open" command is executed without any issues, but the "close" call to the DLL throws error 1097. I checked the calls to the DLL ps3000a.dll (from PicoScope6 app directory) in the LabView code examples and it seems to be exactly the same what I do (methods called, population of interface variables and data types).
Currently, I simply suppress error 1097 in my LabVIEW code, but I am not sure if this is the right way. If error 1097 is thrown by the DLL, does that mean the code in there is executed properly? At least the CloseUnit command works even if it thorws 1097.
That is why you get the error, you need to call ChangePowerSource if the return from Open Unit is not OK. That function tells the driver that you know you are only connected to a USB2 port.
The return from OpenUnit is also 1097, it is just that it is an acceptable return code for the OpenUnit call and allows continued execution. If you call ChangePowerSource using this error code as an input, as we do in our examples, all following API calls will work correctly and the CloseUnit will return 0 (Status OK)