none
Interop question RRS feed

  • Question

  • I have a VB6 DLL in which I have a form. I am using this in my C# project. When I run the C# application, VB6 forms displays with Visual Styles applied - I mean it looks exactly similar to .NET Form. How can I disable this behavior? I mean, I want visual styles to be applied only to .NET Form but VB6 Form (including all controls) should display without visual styles (2 in on behavior).

    Sunday, October 14, 2012 3:15 PM

Answers

All replies

  • If you are talking about the look of common controls, I think that's not possible.  Same goes for the look of the non-client parts of the form.  But, I am no expert in the common controls area, so wait for one or more other opinions.  Also investigate if manifests apply per-module or per-process.

    Jose R. MCP
    Code Samples

    Sunday, October 14, 2012 6:40 PM
  • Visual style should not be enabled by default, common control V6 is supported only in Unicode APPs, and VB6 controls are mostly ANSI.

    Anyway your VB6 DLL can have a separate activation context to load a different version of common controls and not inherit from the exe. This is easily done by adding a manifest resource (you can use resource editing tools or just open your dll in the Visual Studio resource editor, or just add a call to mt.exe to your build process). Alternatively you can switch the activation context when you create your window (and switch back after the windows are created).

    There's also a SetWindowTheme function if you want to selective enable/disable visual styles on individual windows.



    Visual C++ MVP



    Sunday, October 14, 2012 7:46 PM