Why VB6.0 form displays as C# form?

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.

Answers


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);

Need Your Help

Efficiency of Java "Double Brace Initialization"?

java performance collections initialization

In Hidden Features of Java the top answer mentions Double Brace Initialization, with a very enticing syntax:

How to run crontab job every week on Sunday

linux crontab

I'm trying to figure out how to run a crontab job every week on Sunday. I think the following should work, but I'm not sure if I understand correctly. Is the following correct?