Question

I have a Windows application which I'm working on and have experienced a strange problem when debugging. I'm using WTL, and have a CDateTimePickerCtl on the form to set a date. I'm handling the DTN_DATETIMECHANGE event with the following in my message map:

NOTIFY_HANDLER(CONTROL_ID_DATE, DTN_DATETIMECHANGE, OnDateChanged)

This works fine when the app is running in the debugger with no breakpoints. If I have a break point in the OnDateChanged function, even on the first line, VS hangs if I change the time via the drop down calendar. No problems if I edit the date by typing into the control.

I've even attempted to have OnDateChanged just call PostMessage, with an application specific message to try to get around the issue, but if I have a break point in that message handler I get the same odd issue.

It gets even stranger. Not only does VS hang, but once VS is hung, some other applications will hang as well. IE 10, Chrome, Outlook hang, Notepad does not. This is completely repeatable.

I end up having to kill VS several times via Task Manager.

You can see the ticket I've opened with MS Connect here:

https://connect.microsoft.com/VisualStudio/feedback/details/799690/break-point-in-vs-2005-when-debugging-c-gui-hangs-vs-and-other-applications-running-on-the-system-if-calendar-control-has-calendar-displayed

The main question I have is if anyone else has seen this issue and/or if they can reproduce it. I've had another developer here repro on a different machine with the same code, but haven't put together a stripped down version of the code to just repo.

Also note that I'm running VS 2008 on Win7 64 bit.

Was it helpful?

Solution

On earlier versions of Windows I had same issue with combo boxes. Especially when breakpoint set at close time and initiated by another control activation or so. It looks very possible that problem exists also in datetime. For such cases I would recommend use TRACE/ATLTRACE call for debugging purposes.

OTHER TIPS

This question is pretty old, but maybe this answers helps somebody stumbling upon that:

There was an issue at Microsoft's Connect website (https://connect.microsoft.com/VisualStudio/feedback/details/490277/, link is not working anymore) describing this behaviour in a C#/.NET environment.

The Microsoft team found out it was caused by the Win32 DateTimePicker control itself which installs a global mouse hook, causing the described behaviour. Since the bug(?) is already in the Win32 it is the same for .NET/C++ applications.

I don't think the bug will be fixed. Connect website link is down.

Current workaround is to not have a break point in a DateTimePicker event handler.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top