I have a COM DLL which has a form. This DLL is consumed by a C# application. I have enabled Visual Styles for my C# application. I don't want the Visual Styles be applied for COM DLL's form. But when I run my application and lanuch COM DLL's form, it has visual styles applied to it. How will I prevent it?
Many people suggest using a manifest. But, whatever manifests I see on internet, they all use common controls 6. How to create a manifest that uses common controls 5.0 ? Some also suggest using ActivationContext. But, that too needs correct manifest which uses common controls 5.0 right?
Please suggest something.
If you have a window handle for the form (from the COM DLL) then you can disable visual styles on that form using the Win32 API:
SetWindowTheme( hwnd, "", "" );
I believe you'll have to P/Invoke the API. Here's the definition:
[DllImport("uxtheme.dll", ExactSpelling=true, CharSet=CharSet.Unicode)] public static extern int SetWindowTheme( IntPtr hWnd, String pszSubAppName, String pszSubIdList);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With