5 Replies Latest reply on Jan 27, 2020 8:52 PM by YatheeshK_36

    CCyUSBDevice destructor hangs in Windows 7?

    brba_4625011

      Using CyAPI in a C++ DLL project, I create a CCyUSBDevice object dedicated to responding to PnP events with the following code:

      cCyUSBDevice = new CCyUSBDevice(hWnd, CYUSBDRV_GUID, FALSE);

       

      Above, "hWnd" is a handle to a "message only" window that can receive the PnP messages.

       

      All is well.

       

      At shutdown, or whenever the DLL is unloaded, I call the CCyUSBDevice destructor with the following code:

      delete cCyUSBDevice;

       

      Under Windows 10, the destructor executes without problems.  However, under Windows 7, the destructor never returns!!!

       

      This problem under Windows 7 seems to have something to do with "hWnd"...if I provide a bogus value to "hWnd" during construction, the destructor doesn't hang (but, of course, the PnP message handling won't work).

       

      Does anyone know of something I need to do prior to the executing the destructor, in this case where "hWnd" is a legitimate window, so that the destructor executes to completion under Windows 7?

       

      Thanks to anyone for any insight.

       

      -Bruce