CMFCLinkCtrl on dialog causes heap corruption in Multi-Byte character set apps - by Ben of Maine

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 794158 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 7/16/2013 12:43:59 PM
Access Restriction Public


If an MFC Link Control is added to a dialog in an MFC app that is set for Multi-Byte character set, a heap corruption is reported with the dialog is displayed and the control is drawn.

One additional condition is required to show this bug.  In the stdafx.h header file generated by the app wizard, comment out #ifdef _UNICODE and matching #endif to allow the #pragma comment(linker...) line to be included in the project.  These lines allow the app to draw with new style dialogs; without these lines, the dialogs have a WinXP appearance.
Sign in to post a comment.
Posted by Art89 on 11/19/2013 at 2:05 PM
Hi all ,
thanks for this question, I have the same problem with CMFCButton control,
as Ben already said "I haven’t found any documents that indicate that common controls 6 is Unicode-only. Can you point me to an MS article on that?"

my application uses a lot of libraries which are non Unicode and there is no way to change them , now I need to choose , whether convert all char's to wchar's and back for working with non Unicode libs, or not use controls which may have this kind of issues, could you please give a list of controls ?
or give list of common controls 6 controls which in may have such problems in MBCS application.
Posted by Ben of Maine on 7/18/2013 at 9:01 AM
Hi Pat,

Thanks for the reply on this issue.

I haven’t found any documents that indicate that common controls 6 is Unicode-only. Can you point me to an MS article on that?

My app has been MBCS and using the common controls for years now without a hiccup. It was when I started building with VS2012 (and the associated MFC) that I had to do something special to get the visual style support.

Thanks for your help,
Posted by Microsoft on 7/17/2013 at 12:08 PM

Thanks for the report. I investigated and found this is by design. The controls in the Common Controls version 6 DLL (which you are attempting to use by removing the UNICODE #ifdefs) are Unicode only. That's the reason for the UNICODE #ifdefs. You may notice that the CMFCLinkCtrl control is deprecated in MBCS, and the Create method for that class will actually do nothing in MBCS. So your scenario is entirely unsupported. You will need to build Unicode in order to use the link control.

Pat Brenner
Visual C++ Libraries Development
Posted by Microsoft on 7/16/2013 at 10:45 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 7/16/2013 at 12:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(