WinForms Control Hosting in Unmanaged Hosts

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

WinForms controls cannot be easily hosted in unmanaged hosts like Microsoft Word and Excel, lacking essential ActiveX interfaces such as IDataObject, and their runtime behavior is not secure, as they execute immediately upon document load, potentially leading to security vulnerabilities.

Innovation Solution

A hosting architecture is developed, comprising a wrapper control that implements missing ActiveX interfaces and a container control, allowing managed code controls to be instantiated independently of document load, with a design-time implementation for designer interaction and a runtime component that executes within specified security permissions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If WinForms controls are hosted in unmanaged hosts, then security is improved by running managed code, but compatibility is worsened due to missing ActiveX interfaces

Engineering Contradiction:
ImprovesecurityVSAvoidcompatibility
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent introduces an intermediary layer (wrapper control and container control) between the unmanaged host and the managed WinForms control. The wrapper control implements the missing ActiveX interfaces (such as IDataObject) that the unmanaged host expects, while the container control hosts the actual managed control. This intermediary layer translates between the ActiveX interface expectations of the unmanaged host and the managed code interface of the WinForms control, thereby resolving the compatibility issue while maintaining security benefits.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Productivity

If WinForms controls execute immediately on document load, then functionality is improved by automatic execution, but security is worsened due to potential malicious code execution

Engineering Contradiction:
ImprovefunctionalityVSAvoidsecurity
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent implements preliminary action by separating the control loading phase from the control execution phase. When a document is loaded, the control is instantiated and loaded into the container control, but its execution is deferred. The control only executes when explicitly triggered by user action or specific events. This preliminary setup allows the system to prepare the control in a secure state before any code execution occurs, enabling security checks and user consent mechanisms to be applied before the control's code runs.

Inventive Principle:
Principle #10Preliminary action

3Adaptability or versatility

If WinForms controls support scaling, then adaptability is improved, but behavior becomes unpredictable when hosts attempt to scale them

Engineering Contradiction:
Improvescaling supportVSAvoidbehavior predictability
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent applies dynamics by implementing proper event handling and state management for scaled controls. When a host attempts to scale a control, the container control receives the scaling notification and manages the control's state appropriately. The control can dynamically adjust its size while maintaining proper activation/deactivation behavior based on its new dimensions. This dynamic response ensures that scaled controls behave predictably, activating or deactivating as expected based on their scaled state rather than exhibiting undefined behavior.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS7735059B2Winforms control hosting in unmanaged applications
Publication Date: 2010.06.08 MICROSOFT TECHNOLOGY LICENSING LLC
  • US7735059B2 patent drawing
  • US7735059B2 patent drawing
  • US7735059B2 patent drawing

AI summary

Systems and methods for hosting managed code controls within unmanged hosts, such as MICROSOFT Word and Excel. There are two components to the hosting architecture, a wrapper control that implements various interfaces and a container control that hosts the managed code control. A design-time implementation allows for a designer to drag and drop managed code controls onto documents that run in a design component process. A runtime component allows managed code controls to run within hosts under security permissions specified by a policy.