Issues with the comctl32 V5
Irfan Ahmed, Senior Support Escalation Engineer brings this valuable knowledge to us. Recently, he was working on an issue where WPF application was crashing while showing the WPF PrintDialog and OS language set to local language for an example,Hebrew. The same application was working fine with English OS.
Following is the sample code and stack of failing thread in that scenario.
Sample code
public MainWindow()
{
InitializeComponent();
if (Thread.CurrentThread.CurrentCulture.Name == "he-IL")
{
FlowDirection = System.Windows.FlowDirection.RightToLeft;
}
}
private void button1_Click(object sender, RoutedEventArgs e)
{
PrintDialog pt = new PrintDialog();
pt.ShowDialog();
}
Sample Stack
# ChildEBP RetAddr
00 001ed830 600c4d4f comctl32!EditPropSheetTemplate+0x54
01 001ed86c 600c4e74 comctl32!_CreatePageDialog+0x1e
02 001ed88c 600c732e comctl32!_CreatePage+0x3f
03 001edaa8 600c8ea5 comctl32!PageChange+0xd1
04 001ede68 600c974b comctl32!InitPropSheetDlg+0xbde
05 001ededc 771dc4e7 comctl32!PropSheetDlgProc+0x42b
06 001edf08 771f5855 user32!InternalCallWinProc+0x23
07 001edf84 771f59f3 user32!UserCallDlgProcCheckWow+0xd6
08 001edfcc 771f5be3 user32!DefDlgProcWorker+0xa8
09 001edfe8 771dc4e7 user32!DefDlgProcW+0x22
0a 001ee014 771dc5e7 user32!InternalCallWinProc+0x23
0b 001ee08c 771d5294 user32!UserCallWinProcCheckWow+0x14b
0c 001ee0cc 771f4f6c user32!SendMessageWorker+0x4d0
0d 001ee188 771f535a user32!InternalCreateDialog+0xb0d
0e 001ee1ac 771eea2b user32!CreateDialogIndirectParamAorW+0x33
0f 001ee1cc 600c9d77 user32!CreateDialogIndirectParamW+0x1b
10 001ee230 600c9fc5 comctl32!_RealPropertySheet+0x216
11 001ee248 600c9fe0 comctl32!_PropertySheet+0x130
12 001ee258 76c84fea comctl32!PropertySheetW+0xf
13 001ee6f8 76c84d53 comdlg32!Print_InvokePropertySheets+0x27b
14 001ee720 76c84bc4 comdlg32!PrintDlgExX+0x218
15 001ee75c 61b0753f comdlg32!PrintDlgExW+0x2e
In recent past we have seen such problem with the comctl32 V5. Hence, he tested the application with Version 6.0 of comctl32. This is very easy to achieve. Below are steps.
For .NET – Visual Studio
· Add an “Application manifest file” in your project
· Un-comment the following lines of code and rebuild your application. It will use the Comctl32 version 6.0 now.
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
For VB 6.0 Application
1. Create a .txt file in the application folder and name it as “MyApp.exe.manifest.”
2. Copy the following content
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApp"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Another alternative workaround for specific to printdialog crash issue in comctl32.dll v5 is using Windows Form PrintDialog. The below call in WPF application works fine.
System.Windows.Forms.PrintDialog pt = new System.Windows.Forms.PrintDialog();
Note: We have seen another similar issues with comctl32.dll V5 and would recommend to use comctl32.dll V6.0 and test if that helps you resolve issue related to comctl32.
Written and reviewed by: Irfan Ahmed, Senior Support Escalation Engineer
Comments
- Anonymous
May 13, 2014
support.microsoft.com/.../309366 warns that adding a comctl32 V6 manifest to a Visual Basic 6.0 application can cause problems on Windows XP, and that Microsoft does not support it. I don't know whether the warning also applies to later versions of Windows.