Home Dashboard Directory Help
Search

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


Status: 

Closed
 as By Design Help for as By Design


2
0
Sign in
to vote
Type: Bug
ID: 794158
Opened: 7/16/2013 12:43:59 PM
Access Restriction: Public
0
Workaround(s)
view
1
User(s) can reproduce this bug

Description

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.
Details
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,
Ben
Posted by Microsoft on 7/17/2013 at 12:08 PM
Hello,

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(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
MFC heap corruption.zip 7/16/2013 246 KB
MFC heap corruption.zip 7/16/2013 246 KB