CCyUSBDevice destructor hangs in Windows 7?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
brba_4625011
Level 1
Level 1

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

0 Likes
1 Solution

Hello,

You can refer to the C++ bulkloop and streamer application in the FX3 SDK.

The applications sources are present in the path  C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\cpp.

Best Regards,

Yatheesh

View solution in original post

0 Likes
5 Replies
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello,

Please try closing the handle using the Close() function before the destructor.

Refer to the snippet below:

USBDevice->Close();

delete USBDevice; 

USBDevice = NULL;

Let me know if this works.

Thanks,

Yatheesh

0 Likes

Hi Yatheesh, and thank you very much for responding!

Your suggestion, explicitly calling the CCyUSBDevice::Close() function

prior to the deletion, was a good one, but, alas, it didn't solve the

problem.

I also tried destroying the message-only window, via the DestroyWindow()

function, prior to the deletion, and that also did not solve the problem.

I so wish I could debug into CCyUSBDevice::~CCyUSBDevice() to see what the

holdup is!

Thanks again,

Bruce

Bruce Ball

Software Engineer

3980 Ranchero Drive

Ann Arbor, MI 48108

Office: (734) 922-4065

Cell: (734) 355-3144

bruceb@coherix.com <xxxxx@coherix.com>

...........................................

On Fri, Jan 17, 2020 at 1:01 AM YatheeshK_36 <community-manager@cypress.com>

0 Likes

Hello,

You can refer to the C++ bulkloop and streamer application in the FX3 SDK.

The applications sources are present in the path  C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\cpp.

Best Regards,

Yatheesh

0 Likes

Thank you again for your help. I did look at the source code for and build

the two projects that you pointed out. Unfortunately, I didn't find

anything to help my situation.

Bruce Ball

Software Engineer

3980 Ranchero Drive

Ann Arbor, MI 48108

Office: (734) 922-4065

Cell: (734) 355-3144

bruceb@coherix.com <xxxxx@coherix.com>

...........................................

On Tue, Jan 21, 2020 at 9:37 AM YatheeshK_36 <community-manager@cypress.com>

0 Likes

Hello,

You can use the example windows application and modify it to suite your application. Hope this will be of some help.

Thanks,

Yatheesh

0 Likes